:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f0ea;
  --page-top: #f8f5f0;
  --surface: #fffdf9;
  --surface-strong: #ffffff;
  --text: #171411;
  --muted: #625c55;
  --accent: #8f1f2d;
  --accent-ink: #741927;
  --accent-ink-hover: #58121d;
  --accent-solid: #741927;
  --on-accent: #ffffff;
  --inverse-text: #ffffff;
  --header-bg: rgba(248, 245, 240, 0.94);
  --control-bg: #ffffff;
  --control-muted-bg: rgba(255, 255, 255, 0.46);
  --placeholder: #77716a;
  --link-decoration: rgba(116, 25, 39, 0.55);
  --link-decoration-hover: rgba(116, 25, 39, 0.78);
  --accent-border-soft: rgba(127, 29, 29, 0.12);
  --accent-border: rgba(127, 29, 29, 0.2);
  --accent-border-hover: rgba(127, 29, 29, 0.38);
  --accent-soft: rgba(127, 29, 29, 0.05);
  --accent-soft-hover: rgba(127, 29, 29, 0.08);
  --focus-shadow: rgba(127, 29, 29, 0.12);
  --border: rgba(34, 28, 23, 0.14);
  --shadow: 0 10px 30px rgba(34, 28, 23, 0.055);
  --image-filter: saturate(0.72) contrast(0.94);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121110;
  --page-top: #181614;
  --surface: #1c1a18;
  --surface-strong: #24211e;
  --text: #f1ede7;
  --muted: #bdb4aa;
  --accent: #8fb3d1;
  --accent-ink: #a9c8e0;
  --accent-ink-hover: #c9e2f2;
  --accent-solid: #416d8e;
  --on-accent: #ffffff;
  --inverse-text: #171411;
  --header-bg: rgba(24, 22, 20, 0.94);
  --control-bg: #292520;
  --control-muted-bg: rgba(255, 255, 255, 0.045);
  --placeholder: #aaa198;
  --link-decoration: rgba(169, 200, 224, 0.68);
  --link-decoration-hover: rgba(201, 226, 242, 0.92);
  --accent-border-soft: rgba(169, 200, 224, 0.2);
  --accent-border: rgba(169, 200, 224, 0.3);
  --accent-border-hover: rgba(169, 200, 224, 0.48);
  --accent-soft: rgba(169, 200, 224, 0.07);
  --accent-soft-hover: rgba(169, 200, 224, 0.12);
  --focus-shadow: rgba(169, 200, 224, 0.15);
  --border: rgba(241, 237, 231, 0.17);
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.3);
  --image-filter: saturate(0.58) contrast(0.96) brightness(0.72);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.65;
  background: linear-gradient(180deg, var(--page-top) 0%, var(--bg) 30rem);
}

a {
  color: var(--accent-ink);
  text-decoration-line: underline;
  text-decoration-color: var(--link-decoration);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
  transition: color 140ms ease, text-decoration-color 140ms ease;
}

a:visited {
  color: var(--accent-ink);
}

a:hover {
  color: var(--accent-ink-hover);
  text-decoration-color: var(--link-decoration-hover);
}

a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent-ink);
  outline-offset: 3px;
  border-radius: 4px;
}

img {
  max-width: 100%;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  background: var(--text);
  color: var(--inverse-text);
  font-weight: 750;
  text-decoration: none;
  transform: translateY(-180%);
}

.skip-link:visited {
  color: var(--inverse-text);
}

.skip-link:focus-visible {
  color: var(--inverse-text);
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  width: min(980px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0.85rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand,
.brand:visited {
  color: var(--text);
  text-decoration: none;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.35rem;
}

.site-header__controls {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  min-width: 0;
  margin-left: auto;
}

.site-nav a,
.site-nav a:visited {
  color: var(--text);
  text-decoration: none;
  padding: 0.3rem 0.05rem 0.22rem;
  border-bottom: 2px solid transparent;
  transition: color 140ms ease, border-color 140ms ease;
}

.site-nav a:hover {
  color: var(--accent-ink);
  border-bottom-color: var(--accent-border-hover);
}

.site-nav a[aria-current="page"] {
  color: var(--accent-ink);
  border-bottom-color: var(--accent);
  font-weight: 700;
}

.theme-toggle {
  display: inline-grid;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--text);
  cursor: pointer;
  visibility: hidden;
  transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.theme-toggle[data-theme-ready] {
  visibility: visible;
}

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

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

.theme-toggle__icon,
.theme-toggle__icon svg {
  display: block;
  width: 1.1rem;
  height: 1.1rem;
}

.theme-toggle__icon svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.theme-toggle__icon--sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle__icon--moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle__icon--sun {
  display: block;
}

.page-shell {
  width: min(980px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3.5rem;
}

.page-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: clamp(1.25rem, 2.6vw, 2.25rem);
}

.site-footer {
  color: var(--muted);
  font-size: 0.88rem;
}

.site-footer__inner {
  width: min(980px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.1rem 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1.5rem;
  border-top: 1px solid var(--border);
}

.site-footer p {
  margin: 0;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
}

.site-footer__links a,
.site-footer__links a:visited {
  color: var(--muted);
  text-decoration-color: transparent;
}

.site-footer__links a:hover {
  color: var(--accent-ink);
  text-decoration-color: currentColor;
}

.hero {
  padding-bottom: 1.8rem;
  border-bottom: 1px solid var(--border);
}

.hero--home {
  padding-bottom: 2rem;
}

.hero__media {
  margin-bottom: 1.5rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.hero__image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 4;
  object-fit: cover;
  object-position: center 58%;
  filter: var(--image-filter);
}

.hero__content {
  max-width: 46rem;
}

.hero__eyebrow {
  margin: 0 0 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--accent);
}

.hero__title,
.section-title,
.subsection-title,
.entry__title,
.award__title,
.skill__title,
.talk__title {
  font-family: Georgia, "Times New Roman", serif;
}

.hero__title {
  margin: 0;
  font-size: clamp(2.35rem, 5.5vw, 3.65rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.hero__meta,
.entry__meta,
.award__year,
.page-intro,
.talks-empty {
  color: var(--muted);
}

.hero__meta,
.hero__summary {
  margin: 0.75rem 0 0;
  max-width: 46rem;
}

.cv-updated {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.hero__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
}

.hero__intro {
  min-width: 0;
  flex: 1 1 36rem;
}

.hero__actions {
  margin: 0;
  flex: 0 0 auto;
}

.hero__button,
.hero__button:visited {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.58rem 0.92rem;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.hero__button:hover {
  transform: translateY(-1px);
  color: var(--accent-ink-hover);
  border-color: var(--accent-border-hover);
  background: var(--accent-soft-hover);
  text-decoration: none;
}

.page-section {
  margin-top: 2.6rem;
}

.about-copy {
  max-width: 68ch;
}

.about-copy p {
  margin: 0.8rem 0 0;
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-top: 1.2rem;
}

.hero .profile-links {
  margin-top: 0.9rem;
}

.profile-link,
.profile-link:visited {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.48rem 0.8rem;
  border-radius: 7px;
  border: 1px solid var(--accent-border-soft);
  background: var(--control-muted-bg);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.profile-link svg {
  width: 0.98rem;
  height: 0.98rem;
  flex: 0 0 auto;
  fill: currentColor;
}

.profile-link:hover {
  color: var(--accent-ink-hover);
  border-color: var(--accent-border-hover);
  background: var(--accent-soft);
  text-decoration: none;
}

.page-section--image {
  max-width: 44rem;
  margin-right: auto;
}

.hero__media--closing {
  margin: 0;
}

.section-title {
  margin: 0 0 1rem;
  font-size: 1.7rem;
}

.publication-tools {
  display: grid;
  grid-template-columns: minmax(16rem, 1.15fr) minmax(18rem, 1fr);
  gap: 1rem 1.4rem;
  align-items: end;
  margin-top: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-strong);
}

.publication-tools__label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.publication-search__field {
  position: relative;
}

.publication-search__icon {
  position: absolute;
  top: 50%;
  left: 0.85rem;
  display: inline-flex;
  width: 1rem;
  height: 1rem;
  color: var(--muted);
  pointer-events: none;
  transform: translateY(-50%);
}

.publication-search__icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.publication-search input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.65rem 0.85rem 0.65rem 2.45rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: var(--control-bg);
  color: var(--text);
  font: inherit;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.publication-search input::placeholder {
  color: var(--placeholder);
}

.publication-search input:focus-visible {
  outline: 3px solid var(--accent-ink);
  outline-offset: 2px;
  border-color: var(--accent-border-hover);
  box-shadow: 0 0 0 3px var(--focus-shadow);
}

.publication-filter__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.publication-filter--subject {
  grid-column: 1 / -1;
}

.publication-filter__button,
.publication-clear {
  min-height: 2.75rem;
  padding: 0.48rem 0.78rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 750;
  line-height: 1.1;
  transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.publication-filter__button:hover,
.publication-clear:hover {
  border-color: var(--accent-border-hover);
  color: var(--accent-ink-hover);
}

.publication-filter__button[aria-pressed="true"] {
  border-color: var(--accent-solid);
  background: var(--accent-solid);
  color: var(--on-accent);
}

.publication-filter__button:focus-visible,
.publication-clear:focus-visible {
  outline: 3px solid var(--accent-ink);
  outline-offset: 2px;
}

.publication-tools__summary {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  flex-wrap: wrap;
  padding-top: 0.15rem;
}

.publication-results {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.publication-arxiv-link,
.publication-arxiv-link:visited {
  color: var(--accent-ink);
  font-size: 0.88rem;
  font-weight: 750;
  text-decoration: none;
}

.publication-arxiv-link:hover {
  color: var(--accent-ink-hover);
  text-decoration: underline;
}

.publication-empty {
  margin-top: 2.6rem;
  padding: 1.25rem;
  border: 1px dashed var(--border);
  border-radius: 14px;
  text-align: center;
}

.publication-empty__title {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 1.35rem;
}

.publication-empty p {
  margin: 0.4rem 0 1rem;
  color: var(--muted);
}

.publication-clear {
  border-color: var(--accent-border);
  color: var(--accent-ink);
}

.subsection {
  margin-top: 1.6rem;
}

.subsection-title {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}

.entry,
.award,
.publication,
.skill,
.talk {
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}

.entry:first-of-type,
.award:first-of-type,
.publication:first-of-type,
.skill:first-of-type,
.talk:first-of-type {
  border-top: 1px solid var(--border);
}

.entry__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
}

.entry__title,
.award__title,
.skill__title,
.talk__title {
  margin: 0;
  font-size: 1.12rem;
}

.entry__org,
.award__detail,
.skill__detail,
.talk__detail {
  margin: 0.2rem 0 0;
}

.entry__org,
.publication__venue {
  font-style: italic;
}

.entry__meta {
  text-align: right;
  font-size: 0.95rem;
  min-width: 12rem;
}

.entry__meta p {
  margin: 0;
}

.entry__bullets {
  margin: 0.9rem 0 0;
  padding-left: 1.2rem;
}

.entry__bullets li + li {
  margin-top: 0.3rem;
}

.awards,
.skills,
.publications,
.talks {
  margin: 0;
  padding: 0;
  list-style: none;
}

.award {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 1rem;
}

.award__year {
  margin: 0;
  font-weight: 800;
}

.cv-more {
  margin-top: 0.8rem;
  border-top: 1px solid var(--border);
}

.cv-more summary {
  width: fit-content;
  margin-top: 0.9rem;
  color: var(--accent-ink);
  cursor: pointer;
  font-weight: 750;
}

.awards--compact {
  margin-top: 0.35rem;
}

.awards--compact .award {
  padding: 0.75rem 0;
}

.publication {
  display: grid;
  grid-template-columns: 5rem 1fr;
  gap: 0.75rem 1.4rem;
  align-items: start;
  padding: 1.15rem 0;
}

.publication__citation {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.publication__title {
  margin: 0;
  font-size: 1.22rem;
  font-weight: 700;
  line-height: 1.28;
}

.publication__authors {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-style: italic;
}

.publication__year {
  padding-top: 0.05rem;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.publication__body {
  min-width: 0;
}

.publication__status {
  display: inline-block;
  margin-left: 0.55rem;
  padding: 0.12rem 0.48rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  vertical-align: middle;
}

.publication__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1rem;
  margin-top: 0.8rem;
}

.publication__link,
.publication__link:visited {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.25rem;
  padding: 0.35rem 0;
  border: 0;
  background: transparent;
  color: var(--accent-ink);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 140ms ease;
}

.publication__link:hover {
  color: var(--accent-ink-hover);
}

.publication__link-icon {
  display: inline-flex;
  width: 0.95rem;
  height: 0.95rem;
  flex: 0 0 auto;
}

.publication__link-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.publication__link-label {
  display: inline-block;
  line-height: 1;
}

.talks-empty {
  margin: 0;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}

.talk-year + .talk-year {
  margin-top: 2.4rem;
}

.talk-year__title {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0;
  color: var(--accent-ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
}

.talk-year__title::after {
  height: 1px;
  flex: 1;
  background: var(--border);
  content: "";
}

.talk-year__items {
  margin-top: 0.35rem;
}

.talk {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 1rem 1.35rem;
  padding: 1.25rem 0;
}

.talk__date {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.45;
}

.talk__body {
  min-width: 0;
}

.talk__title {
  font-size: 1.2rem;
  line-height: 1.35;
}

.talk__event,
.talk__location {
  margin: 0.28rem 0 0;
}

.talk__location {
  color: var(--muted);
}

.page-section--talks .talk:first-of-type {
  border-top: 0;
}

.page-section--talks .talks-empty {
  border-top: 0;
  padding-top: 0;
}

@media (max-width: 800px) {
  .site-header {
    position: static;
  }

  .site-header__inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.65rem 0 0.55rem;
  }

  .site-header__controls {
    width: 100%;
    gap: 0.75rem;
    margin-left: 0;
  }

  .site-nav {
    flex: 1 1 auto;
  }

  .entry__meta {
    text-align: left;
    min-width: 0;
  }

  .award {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .publication {
    grid-template-columns: 1fr;
    gap: 0.45rem;
  }

  .publication-tools {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .talk {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }

  .talk__date {
    color: var(--accent-ink);
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .hero__actions {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .site-header__inner,
  .page-shell {
    width: min(100% - 1rem, 980px);
  }

  .site-nav {
    width: auto;
    min-width: 0;
    justify-content: space-between;
    gap: 0.35rem;
  }

  .site-nav a,
  .site-nav a:visited {
    padding-inline: 0;
  }

  .page-shell {
    padding-top: 1rem;
  }

  .page-panel {
    padding: 1rem;
    border-radius: 12px;
  }

  .site-footer__inner {
    width: min(100% - 1rem, 980px);
    align-items: flex-start;
    flex-direction: column;
  }

  .hero__title {
    font-size: clamp(2.15rem, 11vw, 2.7rem);
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
