@import url("fonts.css");

/* ---------------------------------------------------------------- tokens */
:root {
  --bg:        #fcfbf9;
  --surface:   #ffffff;
  --text:      #171614;
  --muted:     #6e6a63;
  --faint:     #938d84;
  --rule:      #e6e2db;
  --accent:    #b4530a;
  --accent-bg: #fbf1e5;
  --shadow:    0 1px 2px rgba(23, 22, 20, .04), 0 8px 24px -12px rgba(23, 22, 20, .12);

  --serif: "Newsreader", ui-serif, Georgia, "Times New Roman", serif;
  --sans:  "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono:  ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --measure: 46rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #121110;
    --surface:   #1a1917;
    --text:      #ece9e3;
    --muted:     #9e9890;
    --faint:     #7d776f;
    --rule:      #2b2926;
    --accent:    #e9a23b;
    --accent-bg: #241d13;
    --shadow:    0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.68;
  font-feature-settings: "kern", "liga", "calt";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

p { margin: 0 0 1.05em; }
p:last-child { margin-bottom: 0; }

strong { font-weight: 600; }

::selection { background: var(--accent); color: var(--bg); }

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

/* skip link for keyboard users */
.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff;
  padding: .6rem 1rem; border-radius: 0 0 .5rem 0; z-index: 100;
}
.skip:focus { left: 0; }

/* ---------------------------------------------------------------- nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}
.nav.is-stuck { border-bottom-color: var(--rule); }

.nav-inner {
  max-width: var(--measure); margin: 0 auto; padding: .7rem 1.5rem;
  display: flex; align-items: center; gap: 1.25rem;
}
.nav-home {
  font-family: var(--serif); font-size: 1.02rem; font-weight: 600;
  color: var(--text); white-space: nowrap; letter-spacing: -.01em;
}
.nav-home:hover { color: var(--accent); text-decoration: none; }
.nav-links {
  margin-left: auto; display: flex; gap: 1.1rem;
  overflow-x: auto; scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  font-size: .875rem; color: var(--muted); white-space: nowrap; font-weight: 500;
}
.nav-links a:hover { color: var(--accent); text-decoration: none; }
.nav-links a.here { color: var(--text); }

/* ---------------------------------------------------------------- hero */
.hero { padding: 3.4rem 0 2.4rem; }
.hero-grid {
  display: grid; grid-template-columns: 132px 1fr; gap: 1.9rem; align-items: start;
}
.portrait {
  width: 132px; height: 132px; border-radius: 50%;
  object-fit: cover; display: block;
  box-shadow: var(--shadow);
  border: 1px solid var(--rule);
}
.hero h1 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(2.05rem, 5.4vw, 2.7rem); line-height: 1.1;
  letter-spacing: -.02em; margin: -.22em 0 .1em;
}
.hero h1 .alt { color: var(--muted); font-weight: 400; }
.hero-role { color: var(--muted); font-size: 1.02rem; margin: 0 0 .1em; }
.hero-role a { color: inherit; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 2px; }
.hero-role a:hover { color: var(--accent); text-decoration-color: currentColor; }
.nowrap { white-space: nowrap; }

.hero-tag {
  font-family: var(--serif); font-style: italic; font-size: 1.06rem;
  color: var(--text); margin: .75rem 0 0; max-width: 34rem;
}

.links { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1.15rem; }
.links a {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .845rem; font-weight: 500; color: var(--muted);
  padding: .32rem .62rem; border: 1px solid var(--rule); border-radius: 999px;
  background: var(--surface); transition: color .15s, border-color .15s, transform .15s;
}
.links a:hover {
  color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--rule));
  text-decoration: none; transform: translateY(-1px);
}
.links svg { width: 14px; height: 14px; flex: none; }

/* ---------------------------------------------------------------- sections */
section { padding: 2.1rem 0; }
section + section { border-top: 1px solid var(--rule); }

.sec-head {
  font-size: .72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .13em; color: var(--faint);
  margin: 0 0 1.15rem;
}

/* Sub-page heading. The five-page split (uid=1073) means every page except the
   homepage and the cats page opens with a title instead of the portrait hero,
   so this stands in for .hero h1 there -- same serif, one step down, and it
   carries the top padding the hero used to provide. */
.page-title {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(1.7rem, 4.2vw, 2.15rem); line-height: 1.15;
  letter-spacing: -.02em;
  margin: 0; padding: 3.2rem 0 1.7rem;
}
/* the first section under a page title must not draw the divider rule */
.page-title + section { padding-top: 0; }

/* ---------------------------------------------------------------- prose */
.prose { max-width: 38rem; }
.prose p { color: var(--text); }

/* ---------------------------------------------------------------- research */
.thrusts { display: grid; gap: .85rem; margin-top: 1.35rem; }
.thrust {
  border: 1px solid var(--rule); border-radius: .7rem;
  background: var(--surface); padding: 1.05rem 1.15rem;
  position: relative; overflow: hidden;
}
.thrust::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent); opacity: .8;
}
.thrust h3 {
  font-family: var(--sans); font-size: .96rem; font-weight: 600;
  margin: 0 0 .35rem; letter-spacing: -.005em;
}
.thrust p { font-size: .935rem; color: var(--muted); margin: 0; }
.thrust .meta {
  display: block; margin-top: .55rem;
  font-size: .78rem; color: var(--faint); font-weight: 500;
}

/* ---------------------------------------------------------------- news */
.news { list-style: none; margin: 0; padding: 0; }
.news li {
  display: grid; grid-template-columns: 5.4rem 1fr; gap: 1rem;
  padding: .5rem 0; font-size: .945rem;
}
.news li + li { border-top: 1px dashed var(--rule); }
.news time {
  font-family: var(--mono); font-size: .775rem; color: var(--faint);
  padding-top: .28em; letter-spacing: -.01em; white-space: nowrap;
}
.news .body { color: var(--muted); }
.news .body strong { color: var(--text); font-weight: 600; }

/* ---------------------------------------------------------------- publications */
.pubs { list-style: none; margin: 0; padding: 0; counter-reset: pub; }
.pub { padding: .95rem 0; }
.pub + .pub { border-top: 1px solid var(--rule); }
.pub-title {
  font-size: 1rem; font-weight: 600; line-height: 1.42;
  margin: 0 0 .3rem; letter-spacing: -.008em;
}
.pub-title a { color: var(--text); }
.pub-title a:hover { color: var(--accent); text-decoration: none; }
.pub-authors { font-size: .885rem; color: var(--muted); margin: 0 0 .45rem; }
.pub-authors .me { color: var(--text); font-weight: 600; }
.pub-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }

.venue {
  font-size: .755rem; font-weight: 600; letter-spacing: .02em;
  padding: .2rem .5rem; border-radius: .3rem;
  background: var(--accent-bg); color: var(--accent);
  border: 1px solid var(--rule);
  border-color: color-mix(in srgb, var(--accent) 22%, transparent);
}
.venue.preprint {
  background: transparent; color: var(--faint); border-color: var(--rule);
}
.role {
  font-size: .755rem; color: var(--faint); font-style: italic;
}
.pub-links { display: flex; gap: .55rem; margin-left: auto; }
.pub-links a { font-size: .775rem; font-weight: 500; color: var(--muted); }
.pub-links a:hover { color: var(--accent); }

.award-flag {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .755rem; font-weight: 600;
  color: var(--accent);
}
.award-flag svg { width: 12px; height: 12px; }

/* ---------------------------------------------------------------- entries (experience / education) */
.entries { display: grid; gap: 1.15rem; }
.entry { display: grid; grid-template-columns: 1fr auto; gap: .35rem 1rem; align-items: baseline; }
.entry h3 {
  font-family: var(--sans); font-size: .955rem; font-weight: 600; margin: 0;
  letter-spacing: -.005em;
}
.entry .when {
  font-family: var(--mono); font-size: .76rem; color: var(--faint); white-space: nowrap;
}
.entry .where { grid-column: 1 / -1; font-size: .89rem; color: var(--muted); margin: 0; }
.entry .note { grid-column: 1 / -1; font-size: .89rem; color: var(--muted); margin: .25rem 0 0; }

/* ---------------------------------------------------------------- awards */
.award-hero {
  border: 1px solid var(--rule);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--rule));
  background: var(--accent-bg);
  border-radius: .7rem; padding: 1rem 1.15rem; margin-bottom: 1.1rem;
  display: flex; gap: .85rem; align-items: flex-start;
}
.award-hero .medal { flex: none; color: var(--accent); margin-top: .15rem; }
.award-hero .medal svg { width: 20px; height: 20px; display: block; }
.award-hero h3 { font-family: var(--sans); font-size: .955rem; font-weight: 600; margin: 0 0 .2rem; }
.award-hero p { font-size: .89rem; color: var(--muted); margin: 0; }

.award-list { list-style: none; margin: 0; padding: 0; }
.award-list li {
  display: grid; grid-template-columns: 3rem 1fr; gap: .8rem;
  font-size: .9rem; color: var(--muted); padding: .3rem 0;
}
.award-list li + li { border-top: 1px dashed var(--rule); }
.award-list .yr { font-family: var(--mono); font-size: .76rem; color: var(--faint); padding-top: .2em; }

/* ---------------------------------------------------------------- misc */
.tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .2rem; }
.tag {
  font-size: .78rem; color: var(--muted); font-weight: 500;
  padding: .18rem .55rem; border: 1px solid var(--rule); border-radius: .3rem;
  background: var(--surface);
}

.callout {
  border: 1px solid var(--rule); border-radius: .7rem; background: var(--surface);
  padding: 1rem 1.15rem; font-size: .93rem; color: var(--muted);
}
.callout strong { color: var(--text); }

/* ---------------------------------------------------------------- cats */
.cat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem; margin: 1.5rem 0;
  width: min(58rem, calc(100vw - 3rem));
  margin-left: 50%; transform: translateX(-50%);
}
.cat-card {
  border: 1px solid var(--rule); border-radius: .7rem; overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow);
}
.cat-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.cat-card figcaption {
  padding: .6rem .8rem .7rem; font-size: .82rem; color: var(--muted);
  border-top: 1px solid var(--rule);
}
.cat-card figcaption b,
.cat-card figcaption strong { display: block; color: var(--text); font-weight: 600; font-size: .88rem; }

.placeholder-note {
  font-size: .82rem; color: var(--faint); font-style: italic; margin-top: -.4rem;
}

/* the mock official portrait — kept narrow so the motto stays readable */
.poster { margin: 1.6rem 0 0; text-align: center; }
.poster img {
  width: min(300px, 70%); height: auto; border-radius: .7rem;
  border: 1px solid var(--rule); box-shadow: var(--shadow);
}
.poster figcaption {
  font-size: .82rem; color: var(--faint); font-style: italic; margin-top: .55rem;
}

.dossier {
  display: grid; grid-template-columns: auto 1fr; gap: .4rem 1.1rem;
  font-size: .92rem; margin: 1.35rem 0 0;
  border: 1px solid var(--rule); border-radius: .7rem;
  background: var(--surface); padding: 1.05rem 1.15rem;
}
.dossier dt {
  font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em;
  color: var(--faint); padding-top: .32em; white-space: nowrap;
}
.dossier dd { margin: 0; color: var(--text); }

/* ---------------------------------------------------------------- footer */
footer {
  border-top: 1px solid var(--rule);
  margin-top: 1.5rem; padding: 1.8rem 0 3rem;
  font-size: .82rem; color: var(--faint);
  display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; align-items: baseline;
}
footer a { color: var(--muted); }
footer .spacer { margin-left: auto; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 620px) {
  body { font-size: 16px; }
  /* Let the nav wrap instead of scrolling off-screen. It has always been
     overflow-x:auto, which was survivable when the links were anchors on one
     long page; after the five-page split each link is a whole PAGE, and at
     390px "Awards" and "Cats" sat past the right edge with no affordance that
     anything was there — two of the five pages simply undiscoverable. */
  .nav-inner { flex-wrap: wrap; row-gap: .35rem; }
  .nav-links { flex-wrap: wrap; overflow-x: visible; gap: .55rem .95rem; margin-left: 0; }
  .nav-home { flex: 0 0 100%; }
  .page-title { padding-top: 2.4rem; }
  .hero { padding: 2.4rem 0 1.8rem; }
  .hero-grid { grid-template-columns: 1fr; gap: 1.25rem; }
  .portrait { width: 104px; height: 104px; }
  .hero h1 { margin-top: 0; }
  .news li { grid-template-columns: 1fr; gap: .15rem; }
  .news time { padding-top: 0; }
  .entry { grid-template-columns: 1fr; }
  .pub-links { margin-left: 0; width: 100%; }
  .dossier { grid-template-columns: 1fr; gap: .1rem .8rem; }
  .dossier dd { margin-bottom: .5rem; }
}

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

@media print {
  .nav, footer, .links { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  section + section { border-top: 1px solid #ccc; }
}
