:root {
  color-scheme: light;
  --bg: #fbfbfa;
  --surface: #ffffff;
  --text: #1b1d1d;
  --muted: #60686a;
  --soft: #eff2f1;
  --border: #d9dfdd;
  --link: #1f6f7a;
  --link-visited: #69578d;
  --focus: #ba7a28;
  --max: 920px;
  --measure: 690px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101314;
  --surface: #15191a;
  --text: #e9ece8;
  --muted: #a7b0ad;
  --soft: #202729;
  --border: #313a3d;
  --link: #85cbd6;
  --link-visited: #c1a8e9;
  --focus: #d7a14e;
}

* {
  box-sizing: border-box;
}

html {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
}

body {
  margin: 0;
  min-height: 100vh;
}

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

a {
  color: var(--link);
  text-underline-offset: 0.16em;
}

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

a:hover {
  text-decoration-thickness: 0.12em;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: 0.75rem;
  transform: translateY(-160%);
  padding: 0.45rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  z-index: 10;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1rem;
  align-items: center;
}

.site-name {
  color: var(--text);
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  font-weight: 700;
  text-decoration: none;
}

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

.brand-icon {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  align-items: center;
  font-size: 0.95rem;
}

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

.site-nav a:visited {
  color: var(--muted);
}

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

.theme-toggle {
  width: 2.25rem;
  height: 2.25rem;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.theme-icon {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[data-theme="light"] .theme-icon-sun,
[data-theme="dark"] .theme-icon-moon {
  display: none;
}

.site-main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}

.intro {
  display: block;
}

.intro-heading {
  max-width: 100%;
}

.intro-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, 250px);
  gap: 2rem;
  align-items: start;
  margin-top: 1.35rem;
}

.intro h1,
.page-header h1,
.post-header h1 {
  margin: 0;
  line-height: 1.12;
  letter-spacing: 0;
}

.intro h1 {
  font-size: clamp(2rem, 5.4vw, 3.35rem);
  white-space: nowrap;
}

.lede {
  max-width: var(--measure);
  margin: 1.25rem 0 0;
  font-size: 1.08rem;
}

.intro-body .lede {
  margin-top: 0;
}

.portrait {
  width: 100%;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.portrait-frame {
  margin: 0;
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.8rem;
  margin-top: 1.2rem;
  font-size: 0.96rem;
}

.contact-block {
  margin-top: 2.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
}

.contact-block p {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  margin: 0;
}

.contact-block span {
  color: var(--border);
}

.content-section {
  margin-top: 3.5rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
}

.home-section + .home-section {
  margin-top: 2.25rem;
}

.content-section h2,
.attachments h2,
.abstract h2,
.contact-block h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.page-header {
  max-width: var(--measure);
  margin-bottom: 2rem;
}

.page-header h1,
.post-header h1 {
  font-size: clamp(2rem, 6vw, 3.3rem);
}

.page-header p,
.dek {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.entry-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.entry {
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--border);
}

.entry h2 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.35;
}

.home-preview-entry {
  padding: 0.95rem 0 0.05rem;
  border-bottom: 0;
}

.home-preview-entry + .home-preview-entry {
  margin-top: 0.45rem;
}

.home-preview-entry h3 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.35;
  letter-spacing: 0;
}

.entry p {
  max-width: var(--measure);
  margin: 0.45rem 0 0;
}

.latest-publication {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.35;
}

.publication-entry {
  scroll-margin-top: 1.5rem;
}

.publication-abstract {
  max-width: var(--measure);
}

.entry-links {
  font-size: 0.95rem;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.55rem;
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.meta-line span:not(:first-child)::before {
  content: "/";
  margin-right: 0.55rem;
  color: var(--border);
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

.newsletter-form {
  max-width: var(--measure);
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.newsletter-form-post {
  margin-top: 2.5rem;
}

.newsletter-copy p {
  margin: 0;
}

.newsletter-title {
  font-weight: 700;
}

.newsletter-copy p + p,
.newsletter-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.newsletter-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.newsletter-fields input {
  flex: 1 1 16rem;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.52rem 0.62rem;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.newsletter-fields button {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.52rem 0.78rem;
  background: var(--soft);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.newsletter-fields button:not(:disabled):hover {
  border-color: var(--muted);
}

.newsletter-fields button:disabled {
  cursor: default;
  opacity: 0.62;
}

.newsletter-note {
  margin: 0.45rem 0 0;
}

.back-link {
  margin: 0 0 1.2rem;
  font-size: 0.95rem;
}

.post {
  max-width: var(--measure);
}

.post-image {
  margin: 2rem 0;
}

.post-image img {
  border-radius: 6px;
  border: 1px solid var(--border);
}

.post-image figcaption {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.prose {
  margin-top: 2rem;
}

.abstract {
  margin-top: 2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
}

.abstract p {
  margin: 0;
}

.prose h2,
.prose h3 {
  line-height: 1.25;
  margin: 2rem 0 0.6rem;
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote {
  margin: 1rem 0;
}

.prose blockquote {
  padding-left: 1rem;
  border-left: 3px solid var(--border);
  color: var(--muted);
}

.prose code {
  padding: 0.1rem 0.25rem;
  border-radius: 4px;
  background: var(--soft);
  font-size: 0.9em;
}

.prose pre {
  overflow-x: auto;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--soft);
}

.prose pre code {
  padding: 0;
  background: transparent;
}

.attachments {
  margin-top: 2.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
}

.attachments ul {
  margin: 0;
  padding-left: 1.1rem;
}

.site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 720px) {
  .header-inner {
    grid-template-columns: 1fr auto;
  }

  .site-nav {
    grid-column: 1 / -1;
    order: 3;
  }

  .intro-body {
    grid-template-columns: 1fr;
  }

  .portrait-frame {
    max-width: 220px;
  }

  .site-main {
    padding-top: 2.25rem;
  }

  .site-footer {
    display: block;
  }

  .site-footer p + p {
    margin-top: 0.4rem;
  }
}
