/* ───────── Tokens ───────── */
:root {
  --bg: #fffff8;
  --bg-2: #f7f5ea;
  --ink: #111;
  --ink-2: #3d3d3a;
  --ink-3: #77756c;
  --line: #dedcd0;
  --acc: #8b1e2b;
  --acc-soft: #f3e6e2;
  --serif: "EB Garamond", Garamond, Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15130f; --bg-2: #1d1a15; --ink: #eee9dc; --ink-2: #cfc8b8; --ink-3: #8f887a;
    --line: #36322a; --acc: #e08a8f; --acc-soft: #3a2124; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15130f; --bg-2: #1d1a15; --ink: #eee9dc; --ink-2: #cfc8b8; --ink-3: #8f887a;
  --line: #36322a; --acc: #e08a8f; --acc-soft: #3a2124; color-scheme: dark;
}

/* ───────── Base ───────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 20px/1.6 var(--serif); font-feature-settings: "onum", "liga", "kern";
  -webkit-font-smoothing: antialiased; transition: background .3s, color .3s;
}
a { color: var(--acc); text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 94% / 100% 1px no-repeat; transition: color .2s, background-size .2s; }
a:hover { background-size: 100% 2px; }
::selection { background: var(--acc); color: var(--bg); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; }
button { font: inherit; color: inherit; }
.skip { position: absolute; left: -999px; top: 8px; padding: 6px 12px; background: var(--ink); color: var(--bg); z-index: 50; }
.skip:focus { left: 16px; }

/* ───────── Layout ───────── */
.page {
  max-width: 1160px; margin: 0 auto; padding: 72px 40px 48px;
  display: grid; grid-template-columns: 300px minmax(0, 1fr); column-gap: 72px;
  grid-template-areas: "side head" "side main";
  align-items: start;
}
.side { grid-area: side; position: sticky; top: 40px; }
.head { grid-area: head; }
.main { grid-area: main; max-width: 700px; }
.head, .main { max-width: 700px; }

/* Sidebar */
.portrait { margin: 0; }
.portrait img {
  display: block; width: 100%; height: auto; max-height: calc(100vh - 260px); object-fit: cover; object-position: 50% 70%;
  padding: 7px; border: 1px solid var(--ink); background: var(--bg);
  box-shadow: 10px 10px 0 -1px var(--bg), 10px 10px 0 0 var(--line);
}
.portrait figcaption { margin-top: 12px; font-style: italic; font-size: 15px; color: var(--ink-3); text-align: center; }
.card { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.links a { font-size: 15px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); background-size: 0 1px; }
.links a:hover { color: var(--acc); background-size: 100% 1px; }
.email-line { margin: 12px 0 0; }
.email { padding: 0; border: 0; background: none; cursor: pointer; font-size: 17px; color: var(--ink-2); text-align: left; }
.email:hover { color: var(--acc); }
.email::after { content: " ⧉"; font-size: .8em; color: var(--ink-3); }
.where { margin: 2px 0 0; font-size: 15px; font-style: italic; color: var(--ink-3); }

/* Header */
h1 { margin: -8px 0 0; font-weight: 400; font-size: 64px; line-height: 1.05; letter-spacing: .01em; font-variant: small-caps; }
.sub { margin: 10px 0 0; font-style: italic; font-size: 22px; color: var(--ink-2); line-height: 1.4; }
.nav { margin-top: 22px; padding-bottom: 20px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 22px; }
.nav a { font-size: 15px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); background-size: 0 1px; }
.nav a:hover, .nav a.is-active { color: var(--acc); background-size: 100% 1px; }
.theme { margin-left: auto; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: none; cursor: pointer; color: var(--ink-2); font-size: 16px; line-height: 1; transition: transform .3s, color .2s, border-color .2s; }
.theme:hover { color: var(--acc); border-color: var(--acc); transform: rotate(-20deg); }
.theme__dark { display: none; }
:root[data-theme="dark"] .theme__light { display: none; }
:root[data-theme="dark"] .theme__dark { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme__light { display: none; }
  :root:not([data-theme="light"]) .theme__dark { display: inline; }
}

/* Sections */
section { scroll-margin-top: 24px; }
h2 {
  margin: 52px 0 16px; font-weight: 400; font-size: 15px; letter-spacing: .26em; text-transform: uppercase;
  color: var(--acc); display: flex; align-items: center; gap: 14px;
}
h2::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.main > section:first-child h2 { margin-top: 28px; }
h3 { margin: 32px 0 10px; font-weight: 500; font-size: 19px; font-variant: small-caps; letter-spacing: .06em; color: var(--ink-2); }
p { margin: 0 0 .85em; hyphens: auto; }

.bio p:first-child::first-letter { float: left; font-size: 3.7em; line-height: .8; padding: 7px 9px 0 0; color: var(--acc); }
.bio strong { font-weight: 600; }
.bio s { text-decoration-thickness: 1.5px; text-decoration-color: var(--acc); color: var(--ink-3); }
.facts { margin: 26px 0 0; padding: 18px 0 2px; border-top: 1px solid var(--line); display: grid; grid-template-columns: max-content 1fr; gap: 6px 22px; font-size: 17px; }
.facts dt { font-variant: small-caps; letter-spacing: .06em; color: var(--ink-3); font-size: 17.5px; }
.facts dd { margin: 0; color: var(--ink-2); }

/* Publications */
.refs { list-style: none; margin: 0; padding: 0; counter-reset: r; }
.refs > li {
  counter-increment: r; position: relative; padding: 12px 12px 12px 56px; margin: 0 -12px 6px;
  border-left: 2px solid transparent; transition: background .25s, border-color .25s;
}
.refs > li:hover { background: var(--bg-2); border-left-color: var(--acc); }
.refs > li::before { content: "[" counter(r) "]"; position: absolute; left: 12px; top: 15px; font: 400 14px var(--mono); color: var(--ink-3); }
.refs .t { display: block; font-style: italic; font-weight: 500; font-size: 21px; line-height: 1.35; color: var(--ink); }
.refs .au { color: var(--ink-2); font-size: 18px; }
.me { font-variant: small-caps; font-weight: 600; letter-spacing: .03em; color: var(--ink); }
.refs .v { color: var(--ink-3); font-size: 18px; }
.inv { margin-left: 4px; padding: 0 6px; font-size: 14px; font-variant: small-caps; letter-spacing: .08em; color: var(--acc); border: 1px solid currentColor; }
.inv-detail { margin-left: 6px; font-size: 16px; font-style: italic; color: var(--ink-3); }
.plinks { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 2px 14px; font: 400 13.5px/1.9 var(--mono); }
.plinks a, .plinks button { color: var(--ink-3); background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
.plinks a:hover, .plinks button:hover, .plinks button[aria-expanded="true"] { color: var(--acc); }
.drawer { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s ease; }
.drawer.is-open { grid-template-rows: 1fr; }
.drawer > div { overflow: hidden; min-height: 0; }
.abstract { margin: 10px 0 4px; padding: 4px 0 4px 16px; border-left: 1px solid var(--acc); font-size: 17.5px; color: var(--ink-2); }
.bib { position: relative; margin: 10px 0 4px; padding: 12px 14px; background: var(--bg-2); border: 1px solid var(--line); font: 12.5px/1.6 var(--mono); color: var(--ink-2); overflow-x: auto; white-space: pre; }
.copy { position: absolute; top: 8px; right: 8px; padding: 1px 8px; border: 1px solid var(--line); background: var(--bg); font: 12px/1.7 var(--mono); color: var(--ink-3); cursor: pointer; }
.copy:hover { color: var(--acc); border-color: var(--acc); }
.thesis .t { font-style: italic; font-weight: 500; }
.thesis p { font-size: 18px; color: var(--ink-2); }

/* Talks */
.talks { list-style: none; margin: 0; padding: 0; }
.talks li { display: flex; align-items: baseline; gap: 16px; padding: 10px 0; border-bottom: 1px dotted var(--line); }
.talks .kind { flex: none; width: 60px; font: 400 12.5px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.talks .ttl { flex: 1; }
.talks .w { flex: none; max-width: 40%; text-align: right; font-style: italic; font-size: 17px; color: var(--ink-3); }

/* Gallery */
.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.gallery figure { margin: 0; }
.gallery button { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; overflow: hidden; }
.gallery img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; transition: transform .6s ease, filter .6s; filter: saturate(.92); }
.gallery button:hover img { transform: scale(1.04); filter: saturate(1.05); }
.gallery figcaption { margin-top: 6px; font-size: 15px; font-style: italic; color: var(--ink-3); }

.lightbox { max-width: min(92vw, 1100px); max-height: 92vh; padding: 0; border: 0; background: transparent; overflow: visible; }
.lightbox::backdrop { background: rgba(10, 9, 7, .85); backdrop-filter: blur(4px); }
.lightbox img { display: block; max-width: 100%; max-height: 84vh; margin: 0 auto; }
.lightbox p { margin: 10px 0 0; text-align: center; font-style: italic; color: #eee9dc; }
.lightbox form { position: absolute; top: -44px; right: 0; }
.lightbox form button { width: 36px; height: 36px; border: 1px solid rgba(255,255,255,.4); border-radius: 50%; background: none; color: #fff; font-size: 22px; line-height: 1; cursor: pointer; }

.awareness { margin-top: 64px; padding: 10px 16px; border-left: 2px solid var(--acc); background: var(--bg-2); font-size: 15.5px; line-height: 1.55; color: var(--ink-2); }
.awareness p { margin: 0; }
.awareness__row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 20px; }
.awareness__label { margin-right: 12px; font-size: 12.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--acc); }
.awareness__toggle { padding: 0; border: 0; background: none; cursor: pointer; font-size: 15.5px; font-style: italic; color: var(--ink-2); }
.awareness__toggle:hover, .awareness__toggle[aria-expanded="true"] { color: var(--acc); }
.awareness__toggle .arr { display: inline-block; margin-left: 2px; font-style: normal; transition: transform .3s; }
.awareness__toggle[aria-expanded="true"] .arr { transform: rotate(180deg); }
.awareness__more { padding-top: 8px; color: var(--ink-2); }
.awareness + .foot { margin-top: 32px; }
.foot { margin-top: 64px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 15px; color: var(--ink-3); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); padding: 8px 16px; background: var(--ink); color: var(--bg); font-size: 16px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 60; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.reveal { opacity: 0; transform: translateY(12px); transition: opacity .8s ease, transform .8s ease; }
.reveal.is-in { opacity: 1; transform: none; }

/* ───────── Responsive ───────── */
@media (max-width: 1000px) {
  .page { grid-template-columns: 240px minmax(0, 1fr); column-gap: 44px; padding: 48px 28px; }
  h1 { font-size: 52px; }
  .nav { gap: 4px 14px; }
  .nav a { font-size: 14px; letter-spacing: .12em; }
}
@media (max-width: 800px) {
  .page { grid-template-columns: 220px minmax(0, 1fr); column-gap: 36px; }
  .nav { gap: 4px 12px; }
}
@media (max-width: 760px) {
  body { font-size: 19px; }
  .page { display: flex; flex-direction: column; padding: 24px 16px 32px; }
  .side { display: contents; }
  .portrait { order: 1; }
  .head { order: 2; margin-top: 24px; position: relative; }
  .theme { position: absolute; top: 6px; right: 0; }
  .card { order: 3; margin-top: 16px; padding-top: 0; border: 0; }
  .main { order: 4; }
  .portrait img { aspect-ratio: 4 / 5; max-height: none; object-position: 50% 78%; box-shadow: 7px 7px 0 -1px var(--bg), 7px 7px 0 0 var(--line); }
  .portrait figcaption { text-align: left; }
  h1 { font-size: 44px; margin-top: 0; padding-right: 44px; }
  .sub { font-size: 19px; }
  .nav { gap: 4px 13px; padding-bottom: 14px; }
  .nav a { font-size: 13px; letter-spacing: .12em; }
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dd { margin-bottom: 10px; }
  .refs > li { padding-left: 44px; }
  .refs .t { font-size: 19.5px; }
  .talks li { flex-wrap: wrap; gap: 2px 12px; }
  .talks .w { max-width: none; text-align: left; flex-basis: 100%; padding-left: 72px; }
  .gallery { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}
