@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,600;1,400&display=swap');

:root {
  --paper: #fbfbfb; --panel: #f8f8f8; --ink: #222; --ink-lt: #333;
  --ink-muted: #666; --rule: #d0d0d0; --accent: #a02020;
  --accent-hover: #c03030; --cream: #fefefe; --cream-dk: #ededed;
  --surface: #fff; --surface-alpha: rgba(255,255,255,.96);
  --line-soft: #e5e5e5; --line-faint: #eee;
  --shadow-header: 0 2px 14px rgba(0,0,0,.07);
  --shadow-panel: 0 5px 24px rgba(0,0,0,.045);
  --on-accent: #fff;
  --serif: "Lora", Georgia, serif; --display: "Lora", Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  --paper: #121416; --panel: #202428; --ink: #f0eee9; --ink-lt: #d5d2cd;
  --ink-muted: #aaa7a1; --rule: #444a50; --accent: #e47777;
  --accent-hover: #f09191; --cream: #1a1d20; --cream-dk: #30353a;
  --surface: #1a1d20; --surface-alpha: rgba(26,29,32,.96);
  --line-soft: #343a40; --line-faint: #2b3035;
  --shadow-header: 0 2px 14px rgba(0,0,0,.3);
  --shadow-panel: 0 5px 24px rgba(0,0,0,.2);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--serif); font-size: 14pt; line-height: 1.7; text-rendering: optimizeLegibility; transition: background-color .2s ease, color .2s ease; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
a:focus-visible, button:focus-visible { outline: 3px solid rgba(160,32,32,.28); outline-offset: 4px; border-radius: 2px; }
img, video { max-width: 100%; }
.page { width: 100%; }
.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; }

.site-header { width: 100%; min-height: 1.5em; padding: 1em 1.25em; background: var(--surface-alpha); border-bottom: 1px solid var(--rule); box-shadow: var(--shadow-header); position: relative; z-index: 10; }
.site-header-inner { max-width: 60em; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.header-actions { display: flex; align-items: center; gap: .75em; position: relative; }
.masthead-name { color: var(--ink); font-family: var(--serif); font-size: 1.5em; font-variant: small-caps; letter-spacing: .15em; line-height: 1.2; white-space: nowrap; }
.masthead-name em { color: inherit; font-style: normal; }
.masthead-tagline, .masthead-meta, .top-rule, .top-rule-thin { display: none; }
.site-nav { display: flex; gap: .8em; font-family: var(--serif); font-size: 1.2em; font-variant: small-caps; line-height: 1.2; }
.site-nav a { color: var(--accent); position: relative; }
.site-nav a::before { content: ""; position: absolute; left: 0; bottom: -2px; width: 100%; height: 2px; background: #c44; transform: scaleX(0); transition: transform .3s ease; }
.site-nav a:hover::before, .site-nav a.active::before { transform: scaleX(.99); }
.theme-toggle { display: grid; place-items: center; width: 2.15em; height: 2.15em; padding: 0; color: var(--accent); background: transparent; border: 1px solid var(--rule); border-radius: 50%; cursor: pointer; transition: color .18s ease, border-color .18s ease, transform .18s ease; }
.theme-toggle:hover { color: var(--accent-hover); border-color: var(--accent); transform: translateY(-1px); }
.theme-toggle-icon { position: relative; display: block; width: 1em; height: 1em; }
.theme-toggle-icon::before { content: ""; position: absolute; inset: .08em; border: 2px solid currentColor; border-radius: 50%; }
.theme-toggle-icon::after { content: ""; position: absolute; top: -.05em; right: -.08em; width: .78em; height: .78em; background: var(--surface); border-radius: 50%; }
html[data-theme="dark"] .theme-toggle-icon::before { inset: .24em; z-index: 1; background: currentColor; border: 0; }
html[data-theme="dark"] .theme-toggle-icon::after { inset: -.05em; width: auto; height: auto; background: linear-gradient(currentColor,currentColor) center/2px 100% no-repeat, linear-gradient(90deg,currentColor,currentColor) center/100% 2px no-repeat; border-radius: 0; transform: rotate(45deg) scale(.82); }
.nav-toggle { display: none; }

main { max-width: 60em; margin: 1.75em auto 0; padding: 1.25em 1.4em 1.6em; background: var(--surface); border: 1px solid var(--line-faint); border-radius: 6px; box-shadow: var(--shadow-panel); min-height: 60vh; transition: background-color .2s ease, border-color .2s ease; }
.section { padding: .3em 0 1.5em; }
.section + .section { margin-top: 1.3em; }
.section-label { border-bottom: 2px solid var(--rule); padding: .2em 0 .45em; margin-bottom: .75em; font-family: var(--serif); font-size: 1.5em; font-weight: 400; line-height: 1; }
.section-label::after { display: none; }
.prose { max-width: none; color: var(--ink); font-size: 1em; line-height: 1.72; font-style: normal; }
.prose p, p { margin-top: 0; margin-bottom: .7em; }
.prose p + p { text-indent: 0; }
.prose.drop-cap p:first-child::first-letter { all: unset; }

.home-profile { width: 18em; float: right; margin: 0 0 1.25em 1.5em; padding-left: 10px; }
.profile-card { width: 16em; padding: .25em .5em .65em; text-align: center; overflow-wrap: anywhere; }
.profile-card img { display: block; width: 86%; aspect-ratio: 1; object-fit: cover; object-position: center 30%; border: 4px solid var(--surface); border-radius: 50%; box-shadow: 0 5px 20px rgba(0,0,0,.18); margin: 0 auto .8em; }
.profile-card strong { display: inline-block; margin-top: .1em; font-family: var(--serif); font-size: 1.25em; font-weight: 600; line-height: 1.35; }
.profile-role { font: inherit; white-space: nowrap; }
.profile-emails { margin-top: .18em; }
.profile-email { display: block; color: var(--ink-muted); font-size: .82em; line-height: 1.5; }
.profile-email:hover { color: var(--accent); }
.profile-links { display: flex; align-items: center; justify-content: center; gap: .6em; margin-top: .65em; padding-top: .35em; }
.profile-links a { position: relative; display: grid; place-items: center; width: 2.2em; height: 2.2em; color: var(--ink); border-radius: 50%; transition: color .18s ease, background-color .18s ease, transform .18s ease; }
.profile-links a:hover { color: var(--on-accent); background: var(--accent); transform: translateY(-2px); }
.profile-links svg { width: 1.28em; height: 1.28em; fill: currentColor; }
.profile-links a::after { content: attr(data-label); position: absolute; left: 50%; bottom: calc(100% + .5em); transform: translate(-50%, 4px); padding: .22em .5em; color: var(--surface); background: var(--ink); border-radius: 3px; font-family: var(--serif); font-size: .62em; font-variant: normal; line-height: 1.3; white-space: nowrap; opacity: 0; visibility: hidden; transition: opacity .15s ease, transform .15s ease; pointer-events: none; }
.profile-links a:hover::after, .profile-links a:focus-visible::after { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.home-intro::after { content: ""; display: table; clear: both; }
.home-intro { min-height: 18em; }

.page-intro { max-width: 48em; margin-bottom: 1.4em; color: var(--ink-lt); }
.list-entry { max-width: 52em; padding: .85em 0 1.15em; border-bottom: 1px solid var(--rule); }
.list-entry:last-child { border-bottom: 0; }
.list-entry h2 { margin: 0 0 .15em; font-size: 1.05em; font-weight: 600; }
.list-entry p { margin-bottom: .35em; }
.entry-meta, .dated-entry time { color: var(--ink-muted); font-size: .82em; }
.pending-link { color: var(--ink-muted); font-size: .8em; font-style: italic; }
.dated-entry { display: grid; grid-template-columns: 8em 1fr; gap: 1em; }

.dummy-badge { display: inline-block; margin-bottom: .35em; padding: .06em .48em; color: #6a5715; background: #fff3b5; border: 1px solid #e2ce74; border-radius: 3px; font-family: var(--mono); font-size: .58em; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; vertical-align: middle; }
.year-index { display: flex; align-items: center; flex-wrap: wrap; gap: .65em; margin: 1.2em 0 1.6em; padding: .6em .75em; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 4px; font-size: .86em; }
.year-index span { color: var(--ink-muted); font-variant: small-caps; letter-spacing: .04em; }
.year-index a { padding: .08em .35em; }
.publication-year { scroll-margin-top: 1.5em; }
.publication-year > h2 { margin: 1em 0 .25em; padding-bottom: .25em; border-bottom: 1px solid var(--rule); font-size: 1.25em; font-weight: 400; }
.publication-entry { position: relative; padding: 1em 0 1.25em; border-bottom: 1px solid var(--line-soft); }
.publication-entry { padding-right: 2.7em; }
.publication-entry h3, .talk-entry h2, .writing-entry h2 { margin: 0 0 .18em; font-size: 1.04em; line-height: 1.45; }
.publication-entry p, .talk-entry p, .writing-entry p { margin-bottom: .45em; }
.publication-venue { font-style: italic; }
.publication-authors { color: var(--ink-muted); font-size: .88em; }
.entry-links { display: flex; flex-wrap: wrap; gap: .8em; margin-top: .55em; font-size: .78em; }
.entry-links span { color: var(--ink-muted); font-style: italic; }
.entry-links .primary-paper-link { font-weight: 600; }
.paper-abstract { margin: .7em 0 .9em; }
.paper-abstract summary { position: absolute; top: 1em; right: 0; display: grid; place-items: center; width: 2em; height: 2em; color: var(--accent); background: var(--surface); border: 1px solid var(--rule); border-radius: 50%; cursor: pointer; list-style: none; transition: color .18s ease, border-color .18s ease, background-color .18s ease, transform .18s ease; }
.paper-abstract summary::-webkit-details-marker { display: none; }
.paper-abstract summary::before { content: "+"; font-family: var(--mono); font-size: 1.15em; line-height: 1; }
.paper-abstract[open] summary::before { content: "−"; }
.paper-abstract summary:hover { color: var(--on-accent); background: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.paper-abstract-content { margin-top: .75em; padding: .7em .8em .25em; background: var(--panel); border-left: 2px solid var(--rule); font-size: .86em; line-height: 1.65; }
.paper-abstract-content h4 { margin: 0 0 .35em; font-size: .88em; font-variant: small-caps; letter-spacing: .04em; }
.paper-abstract-content p:last-child { margin-bottom: .35em; }
.scholar-link { margin-top: 1.4em; }
.cv-header { display: flex; align-items: center; justify-content: space-between; gap: 1em; border-bottom: 2px solid var(--rule); margin-bottom: 1.8em; padding-bottom: .45em; }
.cv-header .section-label { flex: 1; margin: 0; padding: .2em 0 0; border: 0; }
.cv-pdf-button { padding: .62em 1em; color: var(--ink-muted); background: var(--panel); border: 1px solid var(--rule); border-radius: 4px; font: 600 .72em/1.2 var(--serif); letter-spacing: .02em; }
.cv-pdf-button:disabled { cursor: not-allowed; opacity: .62; }
.cv-section + .cv-section { margin-top: 2.4em; }
.cv-section > h2 { margin: 0 0 .8em; padding-bottom: .35em; color: var(--ink); border-bottom: 1px solid var(--rule); font-size: 1.2em; font-weight: 400; }
.cv-list { position: relative; display: grid; padding-left: 1.3em; }
.cv-list::before { content: ""; position: absolute; top: .9em; bottom: .9em; left: .25em; width: 1px; background: var(--rule); }
.cv-item { position: relative; min-height: 5.3em; padding: 1em 11.5em 1.1em .75em; border-bottom: 1px solid var(--line-soft); }
.cv-item::before { content: ""; position: absolute; top: 1.38em; left: -1.32em; width: .55em; height: .55em; background: var(--surface); border: 2px solid var(--accent); border-radius: 50%; }
.cv-item:last-child { border-bottom: 0; }
.cv-period { position: absolute; top: 1em; right: 1em; padding: .2em .55em; color: var(--ink-muted); background: var(--surface); border: 1px solid var(--line-soft); border-radius: 999px; font: .68em/1.5 var(--mono); white-space: nowrap; }
.cv-item h3 { margin: 0 0 .12em; font-size: 1em; font-weight: 600; line-height: 1.4; }
.cv-organization { color: var(--accent); font-size: .84em; line-height: 1.5; }
.cv-meta { margin-top: .16em; color: var(--ink-muted); font-size: .76em; line-height: 1.5; }
.cv-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35em; margin: .65em 0 0; padding: 0; color: var(--ink-lt); font-size: .73em; line-height: 1.45; list-style: none; }
.cv-details li { padding: .42em .55em; background: var(--panel); border-left: 2px solid var(--rule); }
.writing-empty { padding: 2.5em 0 3em; color: var(--rule); font-size: 1.5em; text-align: center; }
.talk-entry, .writing-entry { display: grid; grid-template-columns: 8em 1fr; gap: 1.2em; padding: 1em 0 1.25em; border-bottom: 1px solid var(--line-soft); }
.talk-entry:last-child, .writing-entry:last-child { border-bottom: 0; }
.talk-date span { display: block; font-size: .92em; }
.talk-date small, .writing-entry time { color: var(--ink-muted); font-size: .72em; line-height: 1.45; }

.now-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2em 2em; }
.now-item-label { font-weight: 600; margin-bottom: .15em; }
.now-item-content { color: var(--ink); font-size: .95em; line-height: 1.65; }
.topic { color: inherit; }
.timeline, .paper-list, .news-list { list-style: none; margin: 0; padding: 0; }
.home-news { clear: both; margin-top: 1.4em; }
.news-list li { display: grid; grid-template-columns: 4.5em 1fr; gap: 1em; padding: .75em .85em; background: var(--panel); border-left: 3px solid var(--accent); border-bottom: 1px solid var(--line-faint); border-radius: 0 4px 4px 0; }
.news-list li:last-child { border-bottom: 0; }
.news-list time { color: var(--ink-muted); font-size: .85em; }
.news-list span { line-height: 1.55; }
.news-conference { color: var(--accent); font-weight: 600; }
.tl-item { display: grid; grid-template-columns: 9em 1fr; gap: 1em; padding: .55em 0 1em; border-bottom: 1px solid var(--line-faint); }
.tl-dot { display: none; }
.tl-year { color: var(--ink-muted); font-size: .83em; text-align: right; }
.tl-role { font-weight: 600; line-height: 1.4; }
.tl-org { color: var(--accent); font-size: .88em; }
.tl-desc { color: var(--ink-lt); font-size: .9em; line-height: 1.55; }

.paper-list li { display: grid; grid-template-columns: 4em 1fr; gap: 1em; padding: .85em 0 1.1em; border-bottom: 1px solid var(--line-soft); }
.paper-list li:last-child { border-bottom: 0; }
.paper-year { color: var(--ink-muted); font-size: .85em; }
.paper-title { font-size: 1em; font-weight: 600; line-height: 1.5; }
.paper-meta { color: var(--ink-muted); font-size: .86em; line-height: 1.55; }

.contact-block { max-width: 38em; }
.contact-line { display: grid; grid-template-columns: 7em 1fr; padding: .35em 0; border-bottom: 1px solid var(--line-faint); }
.contact-key { color: var(--ink-muted); }
.text-link { font-size: .9em; }
.text-link-muted { color: var(--ink-muted); }
.site-footer { max-width: 60em; margin: 0 auto; padding: 2.5em 1em 2em; color: var(--ink-muted); font-size: .72em; text-align: center; }
.site-footer a { color: var(--ink-muted); }
.site-footer a:hover { color: var(--accent); }
.footer-ornament { margin: 0 .8em; }

@media (max-width: 40em) {
  body { font-size: 12pt; }
  .site-header { padding: .9em 1em; }
  .site-header-inner { align-items: center; position: relative; }
  .masthead-name { font-size: 1.25em; letter-spacing: .1em; }
  .nav-toggle { display: flex; width: 2.4em; height: 2.4em; padding: .48em; border: 0; border-radius: 4px; background: transparent; flex-direction: column; justify-content: space-around; cursor: pointer; }
  .nav-toggle span:not(.sr-only) { display: block; width: 100%; height: 2px; background: var(--ink); transition: transform .2s ease, opacity .2s ease; }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  .site-nav { display: none; position: absolute; top: calc(100% + .9em); right: 0; min-width: 10em; padding: .55em .75em; gap: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.22); font-size: 1em; }
  .site-nav.is-open { display: flex; flex-direction: column; }
  .site-nav a { padding: .35em .25em; }
  .site-nav a::before { bottom: .25em; }
  main { margin-top: .8em; padding: .85em 1em 1.2em; border: 0; border-radius: 0; box-shadow: none; }
  .home-profile { float: none; width: 100%; margin: 0 0 1.2em; padding: 0; }
  .profile-card { width: 100%; padding: .8em; }
  .profile-card img { width: min(12em, 65vw); margin: 0 auto .6em; }
  .profile-role { white-space: normal; }
  .cv-header { align-items: flex-start; flex-direction: column; }
  .cv-pdf-button { width: 100%; }
  .cv-item { min-height: 0; padding: .95em .2em 1em .65em; }
  .cv-period { position: static; display: inline-block; margin-bottom: .45em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .cv-details { grid-template-columns: 1fr; }
  .dated-entry { grid-template-columns: 1fr; gap: .1em; }
  .talk-entry, .writing-entry { grid-template-columns: 1fr; gap: .25em; }
  .now-grid { grid-template-columns: 1fr; }
  .tl-item, .paper-list li, .news-list li { grid-template-columns: 1fr; gap: .1em; }
  .tl-year { text-align: left; }
}

@media (min-width: 40.01em) and (max-width: 68em) {
  .site-header-inner, main { max-width: calc(100% - 2em); }
}

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