/* ------------------------------------------------------------
   Research home: tokens
   teal  = published work
   amber = work in progress
   ------------------------------------------------------------ */
:root {
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --type: "Sometype Mono", "Courier Prime", "Courier New", monospace;
  --measure: 66ch;
  --gap: clamp(1.25rem, 3vw, 2rem);
}

[data-theme="dark"] {
  --bg: #0e1726;
  --surface: #132036;
  --line: #22324d;
  --text: #dce6f2;
  --muted: #8fa3bc;
  --stake: #4fd1c5;
  --leak: #f2b84b;
  --link: #7fe0d6;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --line: #d6deea;
  --text: #10203a;
  --muted: #55667f;
  --stake: #0f8f86;
  --leak: #b07a12;
  --link: #0b7a72;
  color-scheme: light;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}

a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--stake); outline-offset: 3px; border-radius: 2px; }

.wrap { width: min(100% - 2.5rem, 68rem); margin-inline: auto; }

.skip { position: absolute; left: -999px; top: .5rem; background: var(--surface); color: var(--text); padding: .5rem .75rem; z-index: 10; }
.skip:focus { left: .5rem; }

.prose p { margin: 0 0 1em; max-width: var(--measure); }
.prose p:last-child { margin-bottom: 0; }

/* Profile and research text */
.prose--type { font-family: var(--type); font-size: 1.08rem; line-height: 1.75; letter-spacing: -.005em; }
.prose--type p { max-width: 62ch; }

/* ------------------------------------------------------------
   Navigation
   ------------------------------------------------------------ */
.nav {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav__inner { display: flex; align-items: center; gap: 1.5rem; height: 3.5rem; }
.nav__name { font-family: var(--mono); font-weight: 600; font-size: .95rem; color: var(--text); text-decoration: none; margin-right: auto; }
.nav__links { display: flex; gap: 1.25rem; list-style: none; margin: 0; padding: 0; }
.nav__links a { font-family: var(--mono); font-size: .85rem; color: var(--muted); text-decoration: none; }
.nav__links a:hover { color: var(--text); }

.theme-toggle {
  display: grid; place-items: center;
  width: 2.25rem; height: 2.25rem;
  background: none; border: 1px solid var(--line); border-radius: 50%;
  color: var(--muted); cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--muted); }
.theme-toggle svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.theme-toggle .icon-moon { fill: currentColor; stroke: none; }
[data-theme="dark"] .icon-moon, [data-theme="light"] .icon-sun { display: none; }

/* ------------------------------------------------------------
   Hero
   ------------------------------------------------------------ */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(11rem, 24vw, 16rem);
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: center;
  padding-block: clamp(2.5rem, 7vw, 5rem);
  border-bottom: 1px solid var(--line);
}
.hero__name {
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(2.2rem, 5.5vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -.035em;
  margin: 0 0 1.25rem;
}
.hero__intro { color: var(--text); }
.hero__photo { margin: 0; }
.hero__photo img {
  display: block; width: 100%; height: auto;
  aspect-ratio: 1 / 1; object-fit: cover; object-position: 50% 30%;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.links { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; margin: 1.75rem 0 0; padding: 0; }
.links a {
  display: inline-block;
  font-family: var(--mono); font-size: .82rem; font-weight: 500;
  color: var(--text); text-decoration: none;
  padding: .4rem .75rem;
  border: 1px solid var(--line); border-radius: 4px;
  background: var(--surface);
}
.links a:hover { border-color: var(--stake); color: var(--stake); }

/* ------------------------------------------------------------
   Content sections
   ------------------------------------------------------------ */
.block {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: var(--gap);
  padding-block: clamp(2.5rem, 6vw, 4rem);
  border-bottom: 1px solid var(--line);
}
.block:last-of-type { border-bottom: 0; }
.block__title {
  font-family: var(--mono); font-weight: 600; font-size: 1rem; letter-spacing: -.01em;
  margin: .3rem 0 0;
  display: flex; align-items: center; gap: .6rem;
  align-self: start;
}
.block__title::before { content: ""; width: .6rem; height: .6rem; background: var(--stake); border-radius: 1px; flex: none; }
.block__more { margin: 2rem 0 0; color: var(--muted); font-size: 1rem; }

/* ------------------------------------------------------------
   Publications: a chain of blocks, newest first
   ------------------------------------------------------------ */
.chain { list-style: none; margin: 0; padding: 0; position: relative; }
.chain::before {
  content: ""; position: absolute; left: .3rem; top: .55rem; bottom: .55rem;
  width: 1px; background: var(--line);
}
.chain__item { position: relative; padding: 0 0 2.25rem 2rem; }
.chain__item:last-child { padding-bottom: 0; }
.chain__item::before {
  content: ""; position: absolute; left: 0; top: .4rem;
  width: .65rem; height: .65rem; border-radius: 1px;
  background: var(--stake);
}
.chain__item--submitted::before,
.chain__item--preparation::before { background: var(--bg); border: 1.5px solid var(--leak); }

.chain__meta { display: flex; align-items: center; gap: .6rem; margin-bottom: .35rem; }
.chain__year { font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.badge {
  font-family: var(--mono); font-size: .74rem; font-weight: 500;
  padding: .08rem .45rem; border-radius: 3px;
  border: 1px solid currentColor;
}
.badge--published { color: var(--stake); }
.badge--submitted, .badge--preparation { color: var(--leak); border-style: dashed; }

.paper__title { font-family: var(--serif); font-weight: 600; font-size: 1.22rem; line-height: 1.3; margin: 0 0 .3rem; max-width: var(--measure); }
.paper__title a { color: var(--text); text-decoration: none; }
.paper__title a:hover { color: var(--link); text-decoration: underline; }
.paper__authors { margin: 0; color: var(--muted); font-size: 1rem; max-width: var(--measure); }
.paper__authors strong { color: var(--text); font-weight: 600; white-space: nowrap; }
.paper__note { margin: .2rem 0 0; color: var(--muted); font-size: .95rem; font-style: italic; max-width: var(--measure); }
.paper__links { display: flex; gap: 1rem; margin: .45rem 0 0; font-family: var(--mono); font-size: .8rem; }

/* ------------------------------------------------------------
   Talks
   ------------------------------------------------------------ */
.talks { list-style: none; margin: 0; padding: 0; }
.talk {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr);
  column-gap: 1rem;
  padding: .85rem 0;
  border-top: 1px solid var(--line);
}
.talk:first-child { border-top: 0; padding-top: .2rem; }
.talk__year { font-family: var(--mono); font-size: .8rem; color: var(--muted); padding-top: .2rem; grid-row: span 2; }
.talk__title { font-size: 1.08rem; }
.talk__where { color: var(--muted); font-size: .95rem; }

/* ------------------------------------------------------------
   Footer
   ------------------------------------------------------------ */
.footer { padding-block: 2rem 3rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .95rem; }
.footer p { margin: 0; }

/* ------------------------------------------------------------
   Small screens
   ------------------------------------------------------------ */
@media (max-width: 720px) {
  body { font-size: 1.0625rem; }
  .prose--type { font-size: 1.02rem; }
  .nav__links { gap: .9rem; }
  .nav__links a { font-size: .78rem; }
  .hero { grid-template-columns: 1fr; }
  .hero__photo { order: -1; width: 8.5rem; }
  .block { grid-template-columns: 1fr; gap: 1.25rem; }
}
@media (max-width: 460px) {
  .nav__name { font-size: .85rem; }
  .nav__links li:first-child { display: none; }
}
