:root {
  --bg: #fbfbf9;
  --surface: #ffffff;
  --text: #1c1f23;
  --muted: #5d6670;
  --line: #e4e6e8;
  --accent: #0f766e;
  --accent-soft: #e6f2f0;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.04);
  --radius: 14px;
  --max: 1040px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1113;
    --surface: #151a1d;
    --text: #e7eaec;
    --muted: #9aa4ad;
    --line: #242b30;
    --accent: #5eead4;
    --accent-soft: #10302c;
    --shadow: none;
  }
}

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

html { scroll-behavior: smooth; }

body {
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
/* Links inside running text must not rely on colour alone (WCAG 1.4.1). */
p a:not(.chip), footer a, .cv .what a, .card .refs a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -80px; z-index: 50; background: var(--accent); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; }
.skip-link:focus { top: 12px; text-decoration: none; }
main:focus { outline: none; }


.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { font-weight: 800; letter-spacing: -0.02em; color: var(--text); font-size: 1.05rem; }
.brand span { color: var(--accent); }
.brand:hover { text-decoration: none; }
.nav { display: flex; align-items: center; gap: 22px; font-size: 0.93rem; margin-left: auto; }
.nav a { color: var(--muted); }
.nav a:hover, .nav a.active { color: var(--text); text-decoration: none; }
.nav a.active { font-weight: 600; }
.lang-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 4px 12px; font-size: 0.8rem; cursor: pointer; font-family: inherit; white-space: nowrap;
}
.lang-btn:hover { border-color: var(--accent); text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: 4px; }
.nav-note { font-size: 0.78em; color: var(--muted); }
.menu-btn {
  display: none; align-items: center; justify-content: center; width: 44px; height: 44px; margin-right: -10px;
  background: none; border: 0; border-radius: 10px; color: var(--text); font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.menu-btn:focus-visible, .lang-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Desktop menu links: at least 24x24px pointer targets (WCAG 2.5.8). */
@media (min-width: 861px) { .nav a { display: inline-block; min-width: 24px; min-height: 24px; text-align: center; } }

/* hero */
.hero { padding: 72px 0 56px; }
.hero-grid { display: grid; grid-template-columns: 200px 1fr; gap: 44px; align-items: center; }
.hero img { width: 200px; height: 250px; object-fit: cover; border-radius: 18px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.eyebrow { color: var(--accent); font-weight: 600; font-size: 0.9rem; letter-spacing: 0.02em; margin-bottom: 8px; }
.hero h1 { font-size: 2.6rem; line-height: 1.2; letter-spacing: -0.03em; margin-bottom: 10px; }
.hero h1 small { font-size: 1.1rem; color: var(--muted); font-weight: 500; margin-left: 8px; letter-spacing: 0; }
.hero .role { font-size: 1.15rem; color: var(--text); margin-bottom: 6px; }
.hero .affil { color: var(--muted); font-size: 0.95rem; margin-bottom: 18px; }
.hero .bio { max-width: 640px; color: var(--text); margin-bottom: 22px; }
.hero-quiet h1 { font-size: 1.8rem; font-weight: 500; line-height: 1.4; letter-spacing: -0.02em; margin-bottom: 16px; }
.hero-quiet .bio { color: var(--muted); }
.hero .byline { color: var(--muted); font-size: 0.92rem; margin-bottom: 18px; }
.links { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 7px 14px; border-radius: 999px; font-size: 0.88rem;
}
.chip:hover { border-color: var(--accent); text-decoration: none; }
.chip.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .chip.primary { color: #062a26; } }

/* sections */
section.block { padding: 48px 0; border-top: 1px solid var(--line); }
.block-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 22px; gap: 12px; }
.block-head h2 { font-size: 1.45rem; letter-spacing: -0.02em; }
.block-head a { font-size: 0.9rem; }
.page-title { padding: 56px 0 8px; }
.page-title h1 { font-size: 2.1rem; letter-spacing: -0.03em; }
.page-title p { color: var(--muted); margin-top: 6px; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid.two { grid-template-columns: repeat(2, 1fr); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 20px 18px; box-shadow: var(--shadow);
}
.card h3 { font-size: 1.02rem; margin-bottom: 6px; letter-spacing: -0.01em; }
.card p { color: var(--muted); font-size: 0.92rem; }
.card .tag { display: inline-block; font-size: 0.74rem; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 2px 8px; margin-bottom: 10px; font-weight: 600; }
.card .refs { margin-top: 12px; font-size: 0.84rem; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 10px; }
.card .refs li { list-style: none; margin-top: 4px; }
a.card:hover { border-color: var(--accent); text-decoration: none; }
a.card { color: inherit; display: block; }
.card[id] { scroll-margin-top: 84px; }
.card:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* news */
.news li { list-style: none; display: grid; grid-template-columns: 96px 1fr; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.news li:last-child { border-bottom: 0; }
.news time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.9rem; }
.news a { color: var(--text); }
.news a:hover { color: var(--accent); }

/* timeline / cv */
.cv h2 { font-size: 1.2rem; margin: 36px 0 14px; letter-spacing: -0.01em; }
.cv .row { display: grid; grid-template-columns: 150px 1fr; gap: 18px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cv .row .when { color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.cv .row .what strong { display: block; }
.cv .row .what span { color: var(--muted); font-size: 0.92rem; }

/* publications */
.pubs h2 { font-size: 1.15rem; margin: 34px 0 10px; color: var(--muted); }
.pubs ol { padding-left: 0; }
.pubs li { list-style: none; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.pubs li .t { font-weight: 600; display: block; margin: 2px 0; }
.pubs li a.t { color: var(--text); }
.pubs li a.t:hover { color: var(--accent); }
.pubs li .v { color: var(--muted); font-size: 0.9rem; }
.pubs li .me { font-weight: 700; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.badge { display: inline-block; font-size: 0.72rem; border: 1px solid var(--accent); color: var(--accent); border-radius: 6px; padding: 0 6px; margin-left: 6px; vertical-align: 1px; }
.note { color: var(--muted); font-size: 0.88rem; margin-top: 8px; }

/* callout */
.callout { background: var(--accent-soft); border-radius: var(--radius); padding: 22px 24px; display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.callout h3 { font-size: 1.1rem; margin-bottom: 4px; }
.callout p { color: var(--muted); font-size: 0.93rem; }

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

@media (max-width: 860px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
/* The full menu needs ~800px in English, so fold it into the menu button below 860px. */
@media (max-width: 860px) {
  .header-actions { margin-left: auto; }
  .menu-btn { display: inline-flex; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; padding: 6px 24px 12px; gap: 0; margin-left: 0; }
  .nav.open { display: flex; }
  .nav a { padding: 10px 0; }
}
@media (max-width: 680px) {
  .lang-btn { padding: 7px 14px; font-size: 0.85rem; }
  .hero { padding: 40px 0 36px; }
  .hero-grid { grid-template-columns: 1fr; gap: 22px; }
  .hero img { width: 140px; height: 175px; }
  .hero h1 { font-size: 2rem; }
  .hero-quiet h1 { font-size: 1.45rem; }
  .grid, .grid.two { grid-template-columns: 1fr; }
  .cv .row { grid-template-columns: 1fr; gap: 2px; }
  .news li { grid-template-columns: 1fr; gap: 2px; }
  .callout { flex-direction: column; align-items: flex-start; }
}

/* contact */
.contact > * { max-width: 680px; }
.contact .warn { margin: 18px 0 20px; padding: 12px 16px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--radius) var(--radius) 0; font-size: 0.93rem; }
.contact form { display: grid; gap: 14px; }
.contact label { display: grid; gap: 6px; font-size: 0.9rem; font-weight: 600; }
.contact input, .contact select, .contact textarea {
  font: inherit; font-weight: 400; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
}
.contact input:focus, .contact select:focus, .contact textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.contact textarea { resize: vertical; min-height: 160px; }
.contact .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.contact .privacy { font-size: 0.88rem; color: var(--muted); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.contact .privacy summary { cursor: pointer; color: var(--text); font-weight: 600; }
.contact .privacy ul { margin: 8px 0 2px 18px; display: grid; gap: 4px; }
.contact label.check { display: flex; align-items: flex-start; gap: 8px; font-weight: 400; }
.contact label.check input { width: auto; margin-top: 4px; }
.contact button { justify-self: start; cursor: pointer; font: inherit; }
.contact button:disabled { opacity: 0.6; cursor: default; }
.contact .status { min-height: 1.4em; font-size: 0.92rem; color: var(--accent); }
@media (max-width: 360px) { .wrap.contact { padding-left: 10px; padding-right: 10px; } }
/* Reserve the Turnstile widget's height so the Send button does not jump when it loads (CLS). */
.contact .cf-turnstile { min-height: 65px; }
.nf-links { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 10px; }
