:root {
  --font-body: Helvetica, 'Helvetica Neue', Arial, sans-serif;
  --content-width: 930px;
  --prose-width: 760px;
  --font-size-site-name: clamp(2rem, 1.8rem + 0.6vw, 2.25rem);
  --font-size-heading-1: 1.625rem;
  --font-size-heading-2: 1.25rem;
  --font-size-prose: 1.0625rem;
  --footer-height: 64px;
  --background: #ffffff;
  --foreground: #111111;
  --muted: #5d5d5d;
  --line: #cfcfcf;
  --field-line: #9f9f9f;
  --field-node: #555555;
  --link: #075aa8;
  --visited-link: #65418c;
}

:root[data-theme="dark"] {
  --background: #151515;
  --foreground: #f2f2f2;
  --muted: #b4b4b4;
  --line: #4a4a4a;
  --field-line: #888888;
  --field-node: #c5c5c5;
  --link: #8ec5ff;
  --visited-link: #c3a9ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-body, sans-serif);
  font-size: 16px;
  line-height: 1.6;
}

button,
input,
textarea,
select {
  font: inherit;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:visited {
  color: var(--visited-link);
}

.site-frame {
  position: relative;
  isolation: isolate;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--footer-height);
  background: var(--background);
}

.latent-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.9;
}

:root[data-theme="dark"] .latent-field {
  opacity: 0.82;
}

.site-header {
  position: relative;
  z-index: 20;
  flex: 0 0 auto;
  background: var(--background);
}

.header-inner {
  width: min(calc(100% - 40px), var(--content-width));
  margin: 0 auto;
  padding-top: 46px;
}

.identity-row {
  min-height: 126px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
}

.site-name {
  color: var(--foreground);
  font-size: var(--font-size-site-name);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-decoration: none;
}

.site-name:visited {
  color: var(--foreground);
}

.site-role {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.4;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.theme-button,
.menu-button {
  width: 40px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--background);
  color: var(--foreground);
  cursor: pointer;
}

.theme-button span {
  font-size: 19px;
  line-height: 1;
}

.theme-button:hover,
.theme-button:focus-visible,
.menu-button:hover,
.menu-button:focus-visible {
  border-color: var(--foreground);
  outline: none;
}

.menu-button {
  display: none;
  align-content: center;
  padding: 9px;
}

.menu-button span {
  width: 23px;
  height: 1px;
  display: block;
  margin: 3px auto;
  background: currentColor;
}

.site-nav {
  height: 58px;
  display: flex;
  align-items: flex-end;
  gap: clamp(22px, 2.2vw, 36px);
  border-bottom: 1px solid var(--line);
  overflow: visible;
}

.site-nav button,
.site-nav > a {
  flex: 0 0 auto;
  height: 42px;
  display: flex;
  align-items: center;
  padding: 0 0 11px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.nav-group {
  position: relative;
  flex: 0 0 auto;
  height: 42px;
}

.site-nav .nav-group-trigger {
  height: 42px;
  gap: 5px;
}

.nav-group.active > .nav-group-trigger {
  border-bottom-color: var(--foreground);
  color: var(--foreground);
  font-weight: 700;
}

.nav-group-trigger span {
  font-size: 11px;
  transform: translateY(1px);
}

.nav-submenu {
  position: absolute;
  top: calc(100% + 1px);
  left: -14px;
  z-index: 40;
  min-width: 166px;
  display: none;
  padding: 6px 0;
  border: 1px solid var(--line);
  background: var(--background);
}

.nav-submenu.open {
  display: block;
}

.site-nav .nav-submenu button,
.site-nav .nav-submenu a {
  width: 100%;
  height: auto;
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 9px 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  text-align: left;
  text-decoration: none;
}

.site-nav .nav-submenu button:hover,
.site-nav .nav-submenu button:focus-visible,
.site-nav .nav-submenu a:hover,
.site-nav .nav-submenu a:focus-visible,
.site-nav .nav-submenu .active {
  background: color-mix(in srgb, var(--foreground) 7%, transparent);
  color: var(--foreground);
  outline: none;
}

.site-nav button:hover,
.site-nav button:focus-visible,
.site-nav > a:hover,
.site-nav > a:focus-visible {
  color: var(--foreground);
  outline: none;
}

.site-nav button.active,
.site-nav > a.active {
  border-bottom-color: var(--foreground);
  color: var(--foreground);
  font-weight: 700;
}

.tab-content {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.tab-panel {
  width: min(calc(100% - 40px), var(--content-width));
  height: 100%;
  margin: 0 auto;
  padding: 44px 0 32px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

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

.tab-panel:focus {
  outline: none;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 25px;
  font-size: var(--font-size-heading-1);
  font-weight: 700;
  line-height: 1.15;
}

h2 {
  margin: 0 0 7px;
  font-size: var(--font-size-heading-2);
  line-height: 1.4;
}

.tab-panel > p:not(.scholar-link),
.tab-panel > ul,
.tab-panel > ol:not(.publication-list) {
  max-width: var(--prose-width);
  font-size: var(--font-size-prose);
  line-height: 1.65;
}

.tab-panel > p {
  margin-bottom: 26px;
}

ul,
ol {
  padding-left: 26px;
}

li + li {
  margin-top: 8px;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 32px;
  font-size: 16px;
}

.item-list,
.post-list {
  max-width: 880px;
}

.publication-list {
  max-width: 860px;
  margin: 0;
  padding-left: 28px;
  list-style: decimal;
  font-size: 15px;
  line-height: 1.5;
}

.publication-list li {
  padding-left: 7px;
}

.publication-list li + li {
  margin-top: 22px;
}

.publication-list article h2 {
  margin-bottom: 4px;
  font-size: 15px;
  line-height: 1.45;
}

.publication-list article p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
}

.scholar-link {
  margin-top: 26px;
  font-size: 15px;
}

.item-list article,
.post-list article {
  padding: 15px 0;
}

.item-list article:first-child,
.post-list article:first-child {
  padding-top: 0;
}

.item-list article + article,
.post-list article + article {
  border-top: 1px solid var(--line);
}

.item-list p,
.post-list p {
  margin-bottom: 0;
}

.empty-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  max-width: 820px;
  margin-top: 24px;
}

.empty-grid figure,
.empty-grid .empty-message {
  margin: 0;
}

.empty-grid img {
  width: 100%;
  height: auto;
  display: block;
}

.empty-grid figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.empty-message {
  min-height: 132px;
  display: grid;
  place-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 14px;
}

footer {
  position: fixed;
  inset: auto 0 0;
  z-index: 20;
  min-height: var(--footer-height);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 24px;
  border-top: 1px solid var(--line);
  background: var(--background);
  color: var(--muted);
  font-size: 14px;
}

.article {
  padding-top: 40px;
}

.article > * {
  max-width: 760px;
}

.article-header {
  margin-bottom: 44px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.article-header h1 {
  margin-bottom: 14px;
}

.article-meta,
.abstract,
.references {
  color: var(--muted);
}

.abstract {
  margin-top: 26px;
  padding-left: 16px;
  border-left: 2px solid var(--foreground);
}

.equation {
  margin: 28px 0;
  overflow-x: auto;
  text-align: center;
  font-family: "Times New Roman", Times, serif;
  font-size: 20px;
}

.references {
  margin-top: 50px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.references li {
  margin-bottom: 12px;
}

.citation-error {
  color: #9b0000;
}

@media (max-width: 760px) {
  :root {
    --footer-height: 54px;
  }

  .header-inner {
    width: min(calc(100% - 36px), var(--content-width));
    padding-top: 18px;
  }

  .identity-row {
    min-height: 108px;
  }

  .site-name {
    font-size: 1.875rem;
  }

  .site-role {
    max-width: 230px;
    margin-top: 7px;
    font-size: 16px;
  }

  .menu-button {
    display: block;
  }

  .site-nav {
    position: absolute;
    inset: 100% 18px auto;
    z-index: 30;
    height: auto;
    max-height: calc(100dvh - 126px - var(--footer-height));
    display: none;
    align-items: stretch;
    gap: 0;
    overflow-y: auto;
    border: 1px solid var(--line);
    background: var(--background);
  }

  .site-nav.open {
    display: grid;
  }

  .site-nav button,
  .site-nav > a {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 0;
    border-bottom: 1px solid var(--line);
    text-align: left;
  }

  .nav-group {
    width: 100%;
    height: auto;
  }

  .site-nav .nav-group-trigger {
    width: 100%;
    height: 48px;
    justify-content: space-between;
    padding: 0 16px;
    border: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-group.active > .nav-group-trigger {
    border-left: 4px solid var(--foreground);
  }

  .nav-submenu {
    position: static;
    min-width: 0;
    padding: 0;
    border: 0;
    border-bottom: 1px solid var(--line);
  }

  .site-nav .nav-submenu button,
  .site-nav .nav-submenu a {
    min-height: 44px;
    padding: 10px 16px 10px 30px;
    border-bottom: 0;
  }

  .site-nav button:last-child,
  .site-nav > a:last-child {
    border-bottom: 0;
  }

  .site-nav button.active,
  .site-nav > a.active {
    border-left: 4px solid var(--foreground);
  }

  .tab-panel {
    width: min(calc(100% - 36px), var(--content-width));
    padding: 34px 0;
  }

  .tab-panel > p {
    font-size: var(--font-size-prose);
  }

  footer {
    padding-inline: 18px;
    font-size: 13px;
  }
}

@media (max-width: 640px) {
  .theme-button,
  .menu-button {
    width: 41px;
    height: 39px;
  }

  .header-actions {
    gap: 6px;
  }

  .tab-panel {
    padding-top: 30px;
  }

  h1 {
    margin-bottom: 24px;
    font-size: 1.5rem;
  }

  .empty-grid {
    grid-template-columns: 1fr;
  }

  .empty-message {
    min-height: 170px;
  }

  footer {
    flex-wrap: wrap;
    gap: 2px 5px;
    line-height: 1.2;
  }
}

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

  .latent-field {
    opacity: 0.7;
  }
}
