:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-muted: #f4f4f2;
  --text: #171717;
  --muted: #5f5f5a;
  --border: #d8d8d2;
  --accent: #111111;
  --max-width: 1100px;
  --narrow-width: 820px;
  --radius: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101111;
    --surface: #161818;
    --surface-muted: #131515;
    --text: #f5f5f3;
    --muted: #b7b7b0;
    --border: #2d3131;
    --accent: #ffffff;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

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

strong {
  font-weight: 700;
}

/* Links */
a {
  color: inherit;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.6rem 1rem;
  z-index: 100;
}

.skip-link:focus {
  top: 1rem;
}

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

.container.narrow,
.narrow {
  width: min(calc(100% - 2rem), var(--narrow-width));
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(250, 250, 249, 0.86);
  backdrop-filter: blur(10px);
}

@media (prefers-color-scheme: dark) {
  .site-header {
    background: rgba(16, 17, 17, 0.86);
  }
}

.header-inner {
  display: grid;
  gap: 1.25rem;
  padding: 1.4rem 0;
}

.eyebrow {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.92rem;
  letter-spacing: 0;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: 0;
}

h1 {
  font-size: 3.1rem;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.15rem;
}

h4 {
  font-size: 1.1rem;
}

.positioning {
  margin: 1rem 0 0;
  max-width: 55rem;
  font-size: 1.08rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.2rem;
}

.header-nav-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem 1.5rem;
}

.header-quick-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-left: auto;
}

.header-quick-links .button {
  min-height: 2.25rem;
  padding: 0.45rem 0.8rem;
  font-size: 0.92rem;
}

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

.site-nav a:hover,
.site-nav a:focus-visible,
.text-link:hover,
.text-link:focus-visible {
  color: var(--text);
}

.hero {
  padding: 3.25rem 0 2.25rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.hero-side {
  display: grid;
  gap: 1rem;
}

.profile-photo {
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-intro {
  margin: 0;
  font-size: 1.08rem;
  max-width: 46rem;
  text-align: justify;
  text-justify: inter-word;
}

.hero-focus {
  margin: 1rem 0 0;
  max-width: 46rem;
  text-align: justify;
  text-justify: inter-word;
}

.hero-focus-card {
  margin-top: 1rem;
  max-width: 46rem;
}

.hero-note h2 {
  font-size: 1.2rem;
  margin-bottom: 0.8rem;
}

.hero-note ul {
  margin: 0;
}

.section {
  padding: 1.5rem 0 3.5rem;
}

.section-muted {
  background: var(--surface-muted);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-heading {
  margin-bottom: 1.35rem;
}

.section-heading p {
  margin: 0.8rem 0 0;
  color: var(--muted);
  max-width: 46rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.single-card-grid {
  grid-template-columns: 1fr;
}

.publication-list {
  display: grid;
  gap: 1.55rem;
}

.publication-groups {
  display: grid;
  gap: 2rem;
}

.publication-group + .publication-group {
  padding-top: 1.65rem;
  border-top: 1px solid var(--border);
}

.publication-group-title {
  margin-bottom: 1rem;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
}

.publication-group-note {
  font-weight: 600;
  text-transform: none;
}

.publication-entry {
  display: grid;
  grid-template-columns: 8.7rem minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.publication-badge {
  display: grid;
  gap: 0.02rem;
  justify-self: start;
  min-width: 7.8rem;
  margin-top: 0.1rem;
  padding: 0.2rem 0.7rem 0.24rem;
  border-radius: 4px;
  background: #a66f16;
  color: #ffffff;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.15);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
}

.publication-badge-note {
  font-size: 0.68rem;
  font-weight: 650;
}

.publication-main h3 {
  margin-bottom: 0.3rem;
  font-size: 1.02rem;
  font-weight: 650;
  line-height: 1.35;
}

.publication-authors,
.publication-venue {
  margin: 0;
  font-size: 0.97rem;
  line-height: 1.45;
}

.publication-authors {
  color: var(--text);
}

.publication-venue {
  color: var(--text);
}

.self-author {
  text-decoration-line: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
}

.publication-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.55rem;
}

.publication-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 1.65rem;
  padding: 0.24rem 0.7rem;
  border: 1px solid var(--text);
  border-radius: 2px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.publication-action:hover,
.publication-action:focus-visible {
  background: var(--text);
  color: var(--bg);
}

.applied-badge {
  min-width: 8.4rem;
}

.education-thesis-list {
  gap: 1.35rem;
}

.education-badge {
  min-width: 5.2rem;
}

.card .education-meta {
  margin: 0.28rem 0 0;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.45;
}

.education-detail-row {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.55rem;
}

.education-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.education-toggle {
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.education-toggle[aria-expanded="true"] {
  background: var(--text);
  color: var(--bg);
}

.education-detail-panels {
  display: grid;
  max-width: 50rem;
}

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

.education-title-body {
  max-width: 42rem;
  text-align: left;
}

.education-extra {
  margin-top: 1.55rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.card .education-extra h4 {
  margin-bottom: 0.55rem;
  font-size: 1rem;
}

.education-extra-list {
  display: grid;
  gap: 0.85rem;
}

.education-extra-item {
  display: grid;
  grid-template-columns: 8.7rem minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.education-extra-badge {
  min-width: 5.2rem;
  opacity: 0.86;
}

.education-extra-item h5 {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.35;
}

.card .education-extra-item p {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.applied-details {
  margin-top: 0.55rem;
}

.applied-details summary {
  width: max-content;
  cursor: pointer;
  list-style: none;
}

.applied-details summary::-webkit-details-marker {
  display: none;
}

.applied-details summary::marker {
  content: "";
}

.applied-details-body {
  margin-top: 0.55rem;
  max-width: 50rem;
  padding: 0.65rem 0.75rem;
  border: 1px dashed var(--text);
  background: var(--surface);
  font-size: 0.95rem;
  line-height: 1.45;
  text-align: justify;
  text-justify: inter-word;
}

.applied-details-body p {
  margin: 0;
}

.stack {
  display: grid;
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.full-width-card {
  grid-column: 1 / -1;
}

.card h3,
.card h4 {
  margin-bottom: 0.7rem;
}

.card p,
.card ul {
  margin: 0;
}

.card p + p {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.paper-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.katex {
  font-size: 1em;
}

.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.15rem 0;
}

.post-main {
  padding: 3rem 0 4rem;
}

.post-shell {
  width: min(calc(100% - 2rem), var(--narrow-width));
  margin: 0 auto;
}

.post-heading {
  margin-bottom: 1.25rem;
}

.post-heading h1 {
  margin-top: 0.45rem;
  font-size: 2.8rem;
}

.post-summary {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.author-list {
  display: grid;
  gap: 0.35rem;
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.author-name {
  color: var(--text);
  font-weight: 650;
}

.author-links {
  white-space: nowrap;
}

.post-note {
  margin: 1rem 0 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-left: 4px solid #a66f16;
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.post-note p {
  margin: 0;
}

.post-note strong,
.post-note code {
  color: var(--text);
}

.post-note code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

.writing-note {
  margin-bottom: 1rem;
}

.post-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.1rem, 4vw, 2rem);
}

.post-content h2 {
  margin: 2rem 0 0.6rem;
  font-size: 1.35rem;
}

.post-content h2:first-child {
  margin-top: 0;
}

.post-content p,
.post-content ul {
  margin: 0 0 1rem;
}

.post-figure {
  margin: 1.35rem 0;
}

.post-figure img {
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 0.75rem;
}

.post-figure.narrow img {
  width: min(100%, 24rem);
  margin: 0 auto;
}

.post-figure.compact img {
  width: min(100%, 16rem);
  margin: 0 auto;
}

.post-figure.adversarial-figure img {
  width: min(100%, 26rem);
  margin: 0 auto;
}

.post-figure.turing-setup-figure img {
  width: min(100%, 50%);
  margin: 0 auto;
}

.post-figure.cantor-construction-figure img {
  width: 70%;
  margin: 0 auto;
}

.post-figure figcaption {
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.post-content p:last-child,
.post-content ul:last-child {
  margin-bottom: 0;
}

.bibtex {
  margin-top: 1.8rem;
}

.bibtex pre {
  margin: 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) / 2);
  background: var(--surface-muted);
  padding: 1rem;
  line-height: 1.45;
  font-size: 0.86rem;
}

.bibtex code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  white-space: pre;
}

.more-work-card {
  margin-top: 1rem;
}

.list-card {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.2rem;
}

.link-row.compact {
  margin-top: auto;
}

.button,
.text-link {
  text-decoration: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.7rem;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 600;
}

.button:hover,
.button:focus-visible {
  border-color: var(--text);
}

.text-link {
  color: var(--muted);
  font-weight: 600;
}

ul {
  padding-left: 1.15rem;
}

.clean-list li + li,
.compact-list li + li,
li + li {
  margin-top: 0.35rem;
}

.site-footer {
  padding: 1.4rem 0 2.5rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.8rem;
  color: var(--muted);
  font-size: 0.95rem;
}

@media (max-width: 900px) {
  .hero-grid,
  .card-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .header-inner {
    padding: 1rem 0;
  }

  .hero {
    padding-top: 2rem;
  }

  .hero-intro,
  .hero-focus {
    text-align: left;
  }

  .section {
    padding-bottom: 2.5rem;
  }

  .publication-list {
    gap: 1.45rem;
  }

  .publication-entry,
  .education-extra-item {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }

  .publication-badge {
    min-width: 7.8rem;
  }

  .post-figure.turing-setup-figure img {
    width: 100%;
  }

  .card {
    padding: 1rem;
  }

  h1 {
    font-size: 2.25rem;
  }

  h2 {
    font-size: 1.6rem;
  }

  .post-heading h1 {
    font-size: 2.2rem;
  }
}
