@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600;700&display=swap");

:root {
  color-scheme: light;

  --paper: #f5ecdd;
  --paper-soft: #e8d9c3;
  --paper-highlight: #fff8ec;

  --ink: #20170f;
  --body-text: #33281d;
  --muted: #74614f;

  --rule: #d1bea0;
  --rule-strong: #9d835e;

  --accent: #74251e;       /* oxblood */
  --accent-quiet: #8b5e34; /* leather */
  --accent-soft: #eadbc4;
  --link: var(--accent);
  --link-decoration: rgba(116, 37, 30, 0.38);

  --code: #241b13;
  --code-bg: rgba(75, 45, 24, 0.065);

  --panel-bg: rgba(255, 248, 236, 0.62);
  --panel-bg-strong: rgba(255, 248, 236, 0.78);

  --chip-bg: rgba(255, 248, 236, 0.54);
  --chip-ink: #32271c;

  --shadow: 0 20px 70px rgba(57, 39, 22, 0.095);
  --glow: rgba(116, 37, 30, 0.075);
  --glow-secondary: rgba(154, 116, 54, 0.08);

  --max: 1060px;
  --cv-max: 1160px;

  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Cinzel", Georgia, Cambria, "Times New Roman", Times, serif;
  --text-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

html[data-theme="light"] {
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;

  --paper: #120f0b;
  --paper-soft: #1b1610;
  --paper-highlight: #241c13;

  --ink: #f1e7d6;
  --body-text: #d9c9b5;
  --muted: #a99a85;

  --rule: #41362a;
  --rule-strong: #6d5a40;

  --accent: #c7a15d;       /* tarnished brass */
  --accent-quiet: #b88754; /* aged leather */
  --accent-soft: #2b2114;
  --link: var(--accent);
  --link-decoration: rgba(199, 161, 93, 0.46);

  --code: #ead8b8;
  --code-bg: rgba(255, 238, 200, 0.065);

  --panel-bg: rgba(27, 22, 16, 0.8);
  --panel-bg-strong: rgba(31, 25, 18, 0.9);

  --chip-bg: rgba(245, 222, 179, 0.055);
  --chip-ink: #e8dac5;

  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --glow: rgba(199, 161, 93, 0.08);
  --glow-secondary: rgba(116, 37, 30, 0.11);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    color-scheme: dark;

    --paper: #120f0b;
    --paper-soft: #1b1610;
    --paper-highlight: #241c13;

    --ink: #f1e7d6;
    --body-text: #d9c9b5;
    --muted: #a99a85;

    --rule: #41362a;
    --rule-strong: #6d5a40;

    --accent: #c7a15d;
    --accent-quiet: #b88754;
    --accent-soft: #2b2114;
    --link: var(--accent);
    --link-decoration: rgba(199, 161, 93, 0.46);

    --code: #ead8b8;
    --code-bg: rgba(255, 238, 200, 0.065);

    --panel-bg: rgba(27, 22, 16, 0.8);
    --panel-bg-strong: rgba(31, 25, 18, 0.9);

    --chip-bg: rgba(245, 222, 179, 0.055);
    --chip-ink: #e8dac5;

    --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
    --glow: rgba(199, 161, 93, 0.08);
    --glow-secondary: rgba(116, 37, 30, 0.11);
  }
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

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

html {
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(42rem at 6% -4%, var(--glow), transparent 70%),
    radial-gradient(38rem at 92% 8%, var(--glow-secondary), transparent 72%),
    linear-gradient(180deg, var(--paper), var(--paper-soft));
  color: var(--body-text);
  overflow-x: hidden;
}

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

img {
  display: block;
  max-width: 100%;
  height: auto;
}

p {
  margin: 0 0 1rem;
}

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

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-decoration-color: var(--link-decoration);
  text-underline-offset: 0.18em;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

code {
  font-family: var(--mono);
  color: var(--code);
  background: var(--code-bg);
  padding: 0.08rem 0.22rem;
  border-radius: 0.22rem;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--ink);
  line-height: 1.15;
}

h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 4.15rem);
  font-weight: 600;
  letter-spacing: -0.018em;
}

h2 {
  font-family: var(--sans);
  font-size: 1.04rem;
  font-weight: 760;
  text-transform: uppercase;
  letter-spacing: 0.105em;
}

h3 {
  font-size: 1.03rem;
  font-weight: 690;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  width: min(var(--max), calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1.15rem 0 0.85rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  font-family: var(--serif);
  font-size: 1.06rem;
  font-weight: 650;
  color: var(--ink);
  letter-spacing: -0.015em;
  text-decoration: none;
  white-space: nowrap;
}

.wordmark:hover {
  color: var(--accent);
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.085em;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a[aria-current="page"],
.site-nav a:hover {
  color: var(--ink);
  text-decoration: none;
}

.theme-toggle {
  appearance: none;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--panel-bg);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  line-height: 1;
  padding: 0.42rem 0.62rem;
  text-transform: uppercase;
}

.theme-toggle::before {
  content: "◐";
  margin-right: 0.35rem;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.shell {
  width: min(var(--max), calc(100vw - 2rem));
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem) 0;
}

.narrow {
  max-width: 760px;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.82fr) minmax(0, 1.55fr);
  gap: clamp(1.75rem, 5vw, 4.5rem);
  align-items: start;
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1.45fr);
  gap: clamp(2rem, 5vw, 4.75rem);
  align-items: start;
}

.main-copy,
.page-body {
  min-width: 0;
}

.panel,
.card,
.sidebar {
  background: var(--panel-bg);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
}

.panel {
  border-radius: 1.1rem;
}

/* --------------------------------------------------------------------------
   Identity card
   -------------------------------------------------------------------------- */

.identity {
  position: sticky;
  top: 1.25rem;
  padding: 1.25rem;
}

.portrait-frame {
  margin: 0 0 1rem;
  border: 1px solid var(--rule);
  border-radius: 0.9rem;
  overflow: hidden;
  background: var(--paper-soft);
  aspect-ratio: 1 / 1;
}

.portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  filter: saturate(0.92) contrast(1.02);
}

.identity h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin: 0.2rem 0 0.45rem;
}

.affiliation {
  color: var(--muted);
  margin-bottom: 1.2rem;
}

.affiliation a {
  color: inherit;
}

.affiliation a:hover {
  color: var(--accent);
}

.eyebrow {
  margin: 0 0 0.65rem;
  font-family: var(--mono);
  font-size: 0.71rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
}

.contact-list {
  display: grid;
  gap: 0.7rem;
  margin: 1rem 0 1.2rem;
}

.contact-list div {
  display: grid;
  gap: 0.15rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--rule);
}

.contact-list dt {
  font-family: var(--mono);
  font-size: 0.71rem;
  text-transform: uppercase;
  letter-spacing: 0.095em;
  color: var(--muted);
}

.contact-list dd {
  margin: 0;
}

/* --------------------------------------------------------------------------
   Buttons, prose, sections
   -------------------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  padding: 0.55rem 0.86rem;
  background: var(--accent-soft);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.075em;
  text-decoration: none;
  white-space: nowrap;
}

.button.secondary {
  background: transparent;
  border-color: var(--rule);
  color: var(--muted);
}

.button:hover {
  border-color: var(--accent);
  color: var(--ink);
  text-decoration: none;
}

.intro {
  padding-top: 0.5rem;
  font-size: clamp(1.03rem, 1.6vw, 1.18rem);
}

.prose p {
  color: var(--body-text);
  margin-bottom: 1rem;
}

.prose p:last-child {
  margin-bottom: 0;
}

.prose a,
.intro a,
.content a {
  color: var(--link);
  font-weight: inherit;
  text-decoration: none;
}

.prose a:hover,
.intro a:hover,
.content a:hover {
  text-decoration: underline;
  text-decoration-color: var(--link-decoration);
  text-underline-offset: 0.18em;
}

.section-block {
  margin-top: 2.35rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--rule);
}

.section-block.first {
  margin-top: 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-head a {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  text-decoration: none;
}

.section-head a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   Research interests
   -------------------------------------------------------------------------- */

.interest-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.48rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.interest-list li,
.chip,
.interest {
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.35rem 0.62rem;
  background: var(--chip-bg);
  color: var(--chip-ink);
  font-size: 0.92rem;
}

.research-areas {
  display: grid;
  gap: 0.8rem;
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.research-areas li {
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--rule);
}

.research-areas li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.research-areas strong {
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   Papers, talks, service, news
   -------------------------------------------------------------------------- */

.paper,
.entry {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--rule);
}

.paper:first-of-type,
.entry:first-of-type {
  padding-top: 0;
}

.paper:last-child,
.entry:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.paper.compact {
  padding-bottom: 0.35rem;
}

.authors,
.meta,
.links {
  color: var(--muted);
  margin: 0.25rem 0 0;
}

.authors a,
.meta a,
.links a {
  color: inherit;
}

.authors a:hover,
.meta a:hover,
.links a:hover {
  color: var(--accent);
}

.abstract {
  margin-top: 0.75rem;
  color: var(--body-text);
}

.news-list,
.talk-list,
.service-list {
  display: grid;
  gap: 0.7rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.news-list li {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: baseline;
}

.news-list time {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.talk-list li,
.service-list li {
  display: grid;
  gap: 0.18rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--rule);
}

.talk-list li:last-child,
.service-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.talk-title {
  color: var(--ink);
  font-weight: 650;
}

/* --------------------------------------------------------------------------
   Interior pages
   -------------------------------------------------------------------------- */

.page-kicker {
  position: sticky;
  top: 1.25rem;
  align-self: start;
  min-width: 0;
  max-width: 100%;
}

.page-kicker h1 {
  font-size: clamp(1.85rem, 2.75vw, 2.55rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
  max-width: 10.5ch;
  text-wrap: balance;
  overflow-wrap: normal;
}

.lead-block {
  font-size: 1.08rem;
  color: var(--body-text);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  width: min(var(--max), calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1rem 0 2rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-footer a {
  color: inherit;
}

.site-footer a:hover {
  color: var(--accent);
}

.dotsep::before {
  content: "";
}

/* --------------------------------------------------------------------------
   Responsive behavior
   -------------------------------------------------------------------------- */

@media (max-width: 980px) {
  .page-grid {
    grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.35fr);
    gap: clamp(1.5rem, 4vw, 3rem);
  }

  .page-kicker h1 {
    font-size: clamp(1.75rem, 2.8vw, 2.25rem);
  }
}

@media (max-width: 820px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .home-grid,
  .page-grid {
    grid-template-columns: 1fr;
  }

  .identity,
  .page-kicker {
    position: static;
  }
}

@media (max-width: 560px) {
  .site-header,
  .shell,
  .site-footer {
    width: min(calc(100vw - 1rem), var(--max));
  }

  .site-nav {
    gap: 0.65rem;
    font-size: 0.72rem;
  }

  .theme-toggle {
    font-size: 0.68rem;
    padding: 0.38rem 0.54rem;
  }

  .identity {
    padding: 1rem;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
  }

  .news-list li {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }

  .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: no-preference) {
  a,
  .button,
  .theme-toggle {
    transition:
      color 120ms ease,
      border-color 120ms ease,
      text-decoration-color 120ms ease,
      background-color 120ms ease;
  }
}
