:root {
  color-scheme: light;
  --background: #f7f5ef;
  --surface: #eeebe2;
  --text: #202b36;
  --muted: #5e6973;
  --accent: #7d593c;
  --line: #d2ccc0;

  /*
   * QUICK SIZE AND SPACING CONTROLS
   * Change these values to make the whole page roomier or more compact.
   */
  --max-width: 1120px;
  --side-margin: 24px;
  --mobile-side-margin: 16px;
  --body-line-height: 1.55;
  --navigation-height: 52px;
  --hero-top-space: clamp(25px, 3.5vw, 45px);
  --hero-bottom-space: 0px;
  --section-space: 40px;
  --mobile-section-space: 28px;
  --section-title-size: clamp(1.9rem, 3.7vw, 3.05rem);
  --section-title-gap: 26px;
  --name-size: clamp(2.5rem, 5.5vw, 4.4rem);
  --about-column-gap: clamp(34px, 6vw, 72px);
  --publication-space: 8px;
  --publication-line-height: 1.4;
  --publication-title-size: clamp(1.1rem, 2vw, 1.2rem);
  --cv-entry-space: 14px;
  --cv-line-height: 1.4;
  --cv-title-size: 1.05rem;

  font-family: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--navigation-height) + 18px);
}

body {
  margin: 0;
  color: var(--text);
  background: var(--background);
  line-height: var(--body-line-height);
}

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

a:hover {
  color: var(--text);
}

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

.container {
  width: min(
    var(--max-width),
    calc(100% - var(--side-margin) - var(--side-margin))
  );
  margin: 0 auto;
}

/* Top navigation */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--line);
  background: rgb(247 245 239 / 94%);
  backdrop-filter: blur(12px);
}

.nav-inner {
  width: min(
    var(--max-width),
    calc(100% - var(--side-margin) - var(--side-margin))
  );
  min-height: var(--navigation-height);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.nav-name {
  justify-self: start;
  color: var(--text);
  font-family: Arial, sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav-list {
  grid-column: 2;
  align-self: stretch;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 3vw, 36px);
  list-style: none;
}

.nav-list li {
  height: 100%;
  display: flex;
}

.nav-list a {
  position: relative;
  display: flex;
  align-items: center;
  color: var(--text);
  font-family: Arial, sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.nav-list a:hover,
.nav-name:hover {
  color: var(--accent);
}

.nav-section-link::after {
  position: absolute;
  right: 50%;
  bottom: 0;
  left: 50%;
  height: 2px;
  background: #7a263a;
  content: "";
  transition:
    right 180ms ease,
    left 180ms ease;
}

.nav-section-link.is-active {
  color: #7a263a;
}

.nav-section-link.is-active::after {
  right: 0;
  left: 0;
}

/* Name and introductory line */

.hero {
  padding: var(--hero-top-space) 0 var(--hero-bottom-space);
}

.eyebrow,
.section-label {
  margin: 0 0 16px;
  color: var(--accent);
  font-family: Arial, sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  max-width: 900px;
  margin: 0;
  color: #7a263a;
  font-size: var(--name-size);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.045em;
}

.subtitle {
  margin: 20px 0 0;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: clamp(0.96rem, 2vw, 1.15rem);
}

.title-line {
  width: 100%;
  height: 1px;
  margin-top: 36px;
  background: var(--line);
}

/* General sections */

.section {
  padding: var(--section-space) 0;
  scroll-margin-top: var(--navigation-height);
}

.section + .section {
  border-top: 1px solid var(--line);
}

h2 {
  margin: 0 0 var(--section-title-gap);
  font-size: var(--section-title-size);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.035em;
  color: #7a263a;
}

h3 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.4;
}

/* Profile and About me */

.about-grid {
  display: grid;
  grid-template-columns: minmax(210px, 280px) minmax(0, 1fr);
  gap: var(--about-column-gap);
  align-items: start;
}

.profile-photo {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 10;
  object-fit: cover;
  object-position: center;
  border-radius: 4px;
  box-shadow: 0 18px 40px rgb(32 43 54 / 14%);
}

.contact-links {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.contact-link {
  padding: 5px 10px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  background: var(--surface);
  font-family: Arial, sans-serif;
  font-size: 0.88rem;
  line-height: 1.2;
  text-decoration: none;
  transition:
    border-color 150ms ease,
    transform 150ms ease;
}

.contact-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.about-content {
  max-width: 680px;
}

.about-content > p:not(.section-label) {
  margin: 0 0 16px;
  font-size: 1.03rem;
}

.about-content h3 {
  margin-top: 26px;
  font-family: Arial, sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.interest-list {
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

.interest-list li {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-family: Arial, sans-serif;
  font-size: 0.82rem;
}

/* Publications */

.publication-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.publication {
  line-height: var(--publication-line-height);
}

.publication-list li {
  padding: 0 0 var(--publication-space);
}

.publication-list li + li {
  padding-top: var(--publication-space);
  border-top: 1px solid var(--line);
}

.publication h3 {
  max-width: 780px;
  font-size: var(--publication-title-size);
}

.authors,
.venue {
  margin: 5px 0 0;
}

.venue {
  color: #7a263a;
  font-style: normal;
}

.venue-mark {
  color: #7a263a;
  font-family: Arial, sans-serif;
  font-size: 0.92em;
  font-weight: 700;
}

.forthcoming {
  margin-right: 0.3em;
  color: var(--muted);
  font-family: inherit;
  font-size: inherit;
  font-style: italic;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
}

.resource-links {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px;
  font-family: Arial, sans-serif;
  font-size: 0.84rem;
}

.resource-note {
  color: var(--muted);
}

.publication-detail {
  display: inline-block;
}

.publication-detail[open] {
  flex-basis: 100%;
}

.publication-detail summary {
  width: fit-content;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.publication-detail summary:hover {
  color: var(--text);
}

.publication-detail summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.publication-detail summary::marker,
.publication-detail summary::-webkit-details-marker {
  display: none;
  content: "";
}

.detail-toggle {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-weight: 400;
  text-decoration: none;
}

.detail-toggle::after {
  margin-left: 0.35em;
  content: "▸";
  font-size: 0.8em;
}

.detail-toggle[aria-expanded="true"]::after {
  content: "▾";
}

.detail-toggle:hover {
  color: var(--text);
}

.detail-toggle:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.publication-panels {
  margin-top: 12px;
}

.detail-panel {
  max-width: 850px;
  margin-top: 12px;
  padding: 13px 15px;
  border-left: 3px solid #7a263a;
  background: var(--surface);
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.9rem;
}

.publication-panels .detail-panel {
  margin-top: 0;
}

.detail-panel[hidden] {
  display: none;
}

.detail-panel p {
  margin: 0;
}

.detail-panel p + p {
  margin-top: 0.75em;
}

.bibtex {
  overflow-x: auto;
}

.bibtex pre {
  margin: 0;
  white-space: pre;
  overflow-wrap: normal;
}

.bibtex code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  line-height: 1.55;
}

/* Talks */

.talk-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.talk {
  padding: 14px 0;
  display: grid;
  grid-template-columns: 125px 1fr;
  gap: 22px;
  border-top: 1px solid var(--line);
}

.talk:last-child {
  border-bottom: 1px solid var(--line);
}

.talk-date {
  margin: 0;
  align-self: center;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 0.88rem;
}

.talk h3 {
  font-size: 1.15rem;
}

.talk div p {
  margin: 4px 0 0;
  color: var(--muted);
}

.slides-link {
  display: inline;
  margin: 0;
  font-family: Arial, sans-serif;
  font-size: 0.88rem;
}

/* Brief CV */

.cv-list {
  border-top: 1px solid var(--line);
}

.cv-entry {
  padding: var(--cv-entry-space) 0;
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  line-height: var(--cv-line-height);
}

.cv-date {
  margin: 0;
  color: var(--text);
  font-family: Arial, sans-serif;
  font-size: 0.94rem;
}

.cv-entry h3 {
  font-size: var(--cv-title-size);
}

.cv-entry div p {
  margin: 3px 0 0;
}

.cv-institution {
  color: var(--text);
  font-size: 0.94rem;
}

.cv-description {
  color: var(--muted);
  font-size: 0.9rem;
}

.cv-teaching {
  margin-top: 6px;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 0.82rem;
}

.cv-teaching ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.cv-teaching li + li {
  margin-top: 2px;
}

/* Footer */

footer {
  padding: 24px 0;
  border-top: 1px solid var(--line);
  font-family: Arial, sans-serif;
  font-size: 0.82rem;
}

footer .container {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

footer p {
  margin: 0;
}

/* Smaller screens */

@media (max-width: 720px) {
  .container {
    width: min(
      calc(
        100% - var(--mobile-side-margin) - var(--mobile-side-margin)
      ),
      var(--max-width)
    );
  }

  .nav-inner {
    width: min(
      calc(
        100% - var(--mobile-side-margin) - var(--mobile-side-margin)
      ),
      var(--max-width)
    );
    grid-template-columns: auto 1fr;
    gap: 16px;
  }

  .nav-name {
    font-size: 0.7rem;
  }

  .nav-list {
    grid-column: 2;
    justify-self: end;
    gap: 12px;
  }

  .nav-list a {
    font-size: 0.7rem;
  }

  .hero {
    --hero-top-space: 30px;
  }

  .section {
    padding: var(--mobile-section-space) 0;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .profile {
    max-width: 280px;
  }

  .talk,
  .cv-entry {
    grid-template-columns: 1fr;
    gap: 8px;
  }

}

@media (max-width: 520px) {
  .nav-list li:first-child {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
