/* ---------------------------------------------------------------------------
   Tokens
   --------------------------------------------------------------------------- */
:root {
  --bg:        #ffffff;
  --bg-soft:   #f6f7f9;
  --text:      #1d2126;
  --text-soft: #5b6470;
  --text-dim:  #838d99;
  --rule:      #e3e7ec;
  --accent:    #1f5f8b;
  --accent-bg: #eaf2f8;

  --measure: 44rem;
  --gutter: 1rem;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
          "Apple SD Gothic Neo", "Malgun Gothic", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #14171a;
    --bg-soft:   #1c2024;
    --text:      #e6e9ec;
    --text-soft: #a8b1bb;
    --text-dim:  #7d8792;
    --rule:      #2b3137;
    --accent:    #7fb8de;
    --accent-bg: #1d2a33;
  }
}

/* ---------------------------------------------------------------------------
   Base
   --------------------------------------------------------------------------- */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 4.5rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

h1, h2, h3 { line-height: 1.25; font-weight: 650; }
h1 { font-size: 1.75rem; margin: 0 0 .35rem; letter-spacing: -0.01em; }
h2 {
  font-size: 1.1rem;
  margin: 2.4rem 0 .9rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--rule);
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--text-soft);
}
h3 { font-size: 1.02rem; margin: 1.6rem 0 .4rem; }

p { margin: 0 0 1rem; }

.lede { color: var(--text-soft); font-size: 1.05rem; margin-bottom: 0; }

.skip-link {
  position: absolute; left: -999px;
  background: var(--accent); color: #fff; padding: .5rem .9rem;
}
.skip-link:focus { left: .5rem; top: .5rem; z-index: 10; }

/* ---------------------------------------------------------------------------
   Header
   --------------------------------------------------------------------------- */
.site-head {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
}
.site-head-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .5rem 1.5rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}
.brand {
  font-weight: 650;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.1rem;
  margin-left: auto;
  font-size: .92rem;
}
.site-nav a {
  color: var(--text-soft);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

/* ---------------------------------------------------------------------------
   Page
   --------------------------------------------------------------------------- */
main.wrap { padding-top: 2.5rem; padding-bottom: 3.5rem; }
.page-head { margin-bottom: 1.6rem; }

/* Home hero */
.hero {
  display: flex;
  gap: 1.6rem;
  align-items: flex-start;
  margin-bottom: 2rem;
}
.hero-photo {
  flex: 0 0 132px;
  width: 132px;
  height: 132px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg-soft);
  border: 1px solid var(--rule);
}
.hero-text { flex: 1 1 18rem; min-width: 0; }
.hero-text h1 { margin-bottom: .25rem; }
.hero-role { color: var(--text-soft); margin: 0 0 .15rem; }
.hero-place { color: var(--text-dim); font-size: .92rem; margin: 0 0 .9rem; }

.linkbar {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.linkbar a {
  display: inline-block;
  padding: .22rem .62rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: .84rem;
  color: var(--text-soft);
  text-decoration: none;
  background: var(--bg);
}
.linkbar a:hover { color: var(--accent); border-color: var(--accent); }
.linkbar a.primary { background: var(--accent-bg); border-color: var(--accent-bg); color: var(--accent); font-weight: 600; }

/* Keyword chips */
.keywords { display: flex; flex-wrap: wrap; gap: .35rem; padding: 0; margin: 0 0 1rem; list-style: none; }
.keywords li {
  font-size: .84rem;
  padding: .18rem .55rem;
  border-radius: 4px;
  background: var(--bg-soft);
  color: var(--text-soft);
}

/* Home: research highlights */
.highlights { list-style: none; padding: 0; margin: 0 0 1rem; }
.highlights li {
  padding: .7rem 0;
  border-bottom: 1px solid var(--rule);
}
.highlights li:last-child { border-bottom: 0; }
.highlights p { margin: 0; }
.highlights .hl-title { font-weight: 600; }
.highlights .hl-links { font-size: .86rem; color: var(--text-soft); margin-top: .15rem; }

/* Key result lines (Research, Publications) */
.finding { margin: 0 0 .45rem; font-size: .92rem; }
.finding strong { color: var(--text-soft); font-weight: 600; }
.theme .finding { margin-bottom: .7rem; }
.theme .basis { font-size: .9rem; color: var(--text-soft); margin-bottom: .6rem; }

/* CV table of contents */
.toc { display: flex; flex-wrap: wrap; gap: .35rem .9rem; padding: 0; margin: 1.2rem 0 0; list-style: none; font-size: .9rem; }
.toc a { color: var(--text-soft); text-decoration: none; border-bottom: 1px solid var(--rule); }
.toc a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* News */
.news { list-style: none; padding: 0; margin: 0; }
.news li {
  display: flex;
  gap: .9rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--rule);
}
.news li:last-child { border-bottom: 0; }
.news time {
  flex: 0 0 5.2rem;
  color: var(--text-dim);
  font-size: .86rem;
  font-variant-numeric: tabular-nums;
  padding-top: .12rem;
}
.news p { margin: 0; }

/* Research themes */
.theme { margin-bottom: 1.9rem; }
.theme h3 { margin-top: 0; }
.theme p:last-child { margin-bottom: 0; }
.research-papers { margin: 0; padding-left: 1.2rem; font-size: .92rem; }
.research-papers li { margin-bottom: .65rem; }
.research-papers li:last-child { margin-bottom: 0; }
.research-paper-meta { display: block; color: var(--text-soft); font-size: .86rem; }

/* Publications */
.pub-list { list-style: none; padding: 0; margin: 0; }
.pub {
  padding: .9rem 0 1rem;
  border-bottom: 1px solid var(--rule);
}
.pub:last-child { border-bottom: 0; }
.pub-title { font-weight: 600; margin: 0 0 .2rem; }
.pub-authors { margin: 0 0 .2rem; font-size: .92rem; color: var(--text-soft); }
.pub-authors strong { color: var(--text); }
.pub-meta { margin: 0 0 .45rem; font-size: .9rem; color: var(--text-soft); }
.pub-meta .venue { font-style: italic; }
.pub-summary { margin: 0 0 .45rem; font-size: .92rem; color: var(--text-soft); }
.pub-links { margin: 0; font-size: .86rem; }
.tag {
  display: inline-block;
  margin-left: .3rem;
  padding: .05rem .42rem;
  border-radius: 3px;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Figures */
.figure {
  /* Let the figure run wider than the text column, centred, but never past the viewport gutters. */
  width: min(100vw - 2 * var(--gutter), 62rem);
  margin: 1.4rem 0 1.8rem 50%;
  transform: translateX(-50%);
}
.figure a { display: block; }
.figure img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 6px; background: #fff; }
.figure figcaption { margin-top: .55rem; font-size: .86rem; line-height: 1.5; color: var(--text-soft); }

/* Project cards */
.card {
  padding: 1rem 0 1.1rem;
  border-bottom: 1px solid var(--rule);
}
.card:last-child { border-bottom: 0; }
.card h3 { margin: 0 0 .25rem; }
.card-meta { margin: 0 0 .5rem; font-size: .88rem; color: var(--text-dim); }
.card-role { margin: 0 0 .5rem; font-size: .92rem; color: var(--text-soft); }
.card p:last-child { margin-bottom: 0; }
.card-links { font-size: .86rem; }
.card-outputs { margin: .35rem 0 0; font-size: .9rem; }
.card-outputs strong { color: var(--text-soft); font-weight: 600; }
.card-outputs ul { margin: .15rem 0 0; padding-left: 1.2rem; }
.card-outputs li { margin-bottom: .15rem; }

/* Compact families with connected KR/US records nested below each heading. */
.patent-group-title { margin: 1.5rem 0 .25rem; color: var(--text-soft); }
.patent-card { margin: .7rem 0; padding: .75rem .9rem; border: 1px solid var(--rule); border-radius: 6px; }
.patent-header { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .65rem; }
.patent-header h4 { margin: 0; font-size: .97rem; line-height: 1.4; font-weight: 650; }
.patent-assignee { font-size: .8rem; color: var(--text-soft); }
.patent-records { margin-top: .55rem; padding-left: .8rem; border-left: 2px solid var(--rule); }
.patent-record { position: relative; }
.patent-record::before { content: ""; position: absolute; left: calc(-.8rem - 2px); top: .65rem; width: .55rem; border-top: 2px solid var(--rule); }
.patent-record + .patent-record { margin-top: .55rem; }
.patent-title { margin: 0 0 .15rem; font-size: .92rem; line-height: 1.45; }
.patent-title strong { font-weight: 500; }
.patent-title .patent-country { display: inline-block; margin-right: .3rem; padding: 0 .25rem; border-radius: 3px; font-size: .76rem; font-weight: 700; color: var(--accent); background: var(--accent-bg); }
.patent-meta { margin: 0; font-size: .84rem; line-height: 1.55; color: var(--text-soft); overflow-wrap: anywhere; }
.patent-status { font-weight: 500; }
.patent-family { margin-top: .3rem; }

/* Definition-style rows */
.rows { margin: 0; }
.row {
  display: flex;
  gap: 1.1rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--rule);
}
.row:last-child { border-bottom: 0; }
.row-when {
  flex: 0 0 9.75rem;          /* wide enough for "Mar 2012 – Feb 2019" on one line */
  white-space: nowrap;
  color: var(--text-dim);
  font-size: .88rem;
  font-variant-numeric: tabular-nums;
  padding-top: .1rem;
}
.row-what { flex: 1 1 auto; min-width: 0; }
.row-what p { margin: 0; }
.row-what .sub { color: var(--text-soft); font-size: .9rem; }

.inline-list { color: var(--text-soft); }

/* Footer */
.site-foot {
  border-top: 1px solid var(--rule);
  background: var(--bg-soft);
  padding: 1.8rem 0;
  font-size: .9rem;
  color: var(--text-soft);
}
.site-foot p { margin: 0 0 .5rem; }
.foot-meta { color: var(--text-dim); font-size: .84rem; margin-bottom: 0; }

/* ---------------------------------------------------------------------------
   Narrow screens
   --------------------------------------------------------------------------- */
@media (max-width: 34rem) {
  .hero { flex-direction: column; gap: 1.1rem; }
  .hero-photo { width: 104px; height: 104px; flex-basis: auto; }
  .site-nav { margin-left: 0; width: 100%; }
  .news li { flex-direction: column; gap: .1rem; }
  .news time { flex-basis: auto; }
  .row { flex-direction: column; gap: .15rem; }
  .row-when { flex-basis: auto; }
  .patent-card { padding: .65rem .7rem; }
}

@media print {
  .site-head, .site-foot, .skip-link { display: none; }
  body { font-size: 11pt; }
  a { color: inherit; text-decoration: none; }
}
