:root {
  color-scheme: light;
  --bg: #f3f3ef;
  --paper: rgba(252, 252, 249, 0.92);
  --text: #121212;
  --muted: #676763;
  --line: rgba(18, 18, 18, 0.12);
  --line-strong: rgba(18, 18, 18, 0.22);
  --accent: #111;
  --accent-soft: #ecebe4;
  --grid-line: rgba(18, 18, 18, 0.025);
  --glow: rgba(255, 255, 255, 0.9);
  --selection-bg: #151515;
  --selection-fg: #f6f5ef;
  --button-bg: #111;
  --button-border: #111;
  --button-fg: #f6f5ef;
  --button-hover: #242424;
  --button-muted-bg: #2a2a2a;
  --button-muted-border: #2a2a2a;
  --button-muted-fg: #f1efe7;
  --button-muted-hover: #3a3a3a;
  --tag-bg: #ece9df;
  --tag-border: rgba(18, 18, 18, 0.1);
  --tag-fg: #3e3d37;
  --inline-code-bg: #e6e2d6;
  --inline-code-border: rgba(18, 18, 18, 0.14);
  --inline-code-fg: #050505;
  --post-hover-bg: rgba(255, 255, 255, 0.98);
  --post-hover-shadow: 0 10px 24px rgba(18, 18, 18, 0.06);
  --network-line: rgba(17, 17, 17, 0.22);
  --network-node: rgba(17, 17, 17, 0.5);
  --network-glow: rgba(120, 132, 124, 0.34);
  --code-bg: #151515;
  --code-fg: #f4f1e8;
  --code-muted: #bdb7a8;
  --code-keyword: #f7c873;
  --code-string: #9ad7b0;
  --code-number: #ef9a9a;
  --code-comment: #8f8a7a;
  --code-operator: #d9d3c7;
  --code-name: #8ecae6;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101312;
  --paper: rgba(20, 24, 23, 0.9);
  --text: #ece9df;
  --muted: #a7ac9f;
  --line: rgba(236, 233, 223, 0.12);
  --line-strong: rgba(236, 233, 223, 0.22);
  --accent: #f4f1e8;
  --accent-soft: #1b211f;
  --grid-line: rgba(236, 233, 223, 0.045);
  --glow: rgba(78, 99, 90, 0.18);
  --selection-bg: #ece9df;
  --selection-fg: #111;
  --button-bg: #ece9df;
  --button-border: #ece9df;
  --button-fg: #111;
  --button-hover: #d9d3c7;
  --button-muted-bg: #27302d;
  --button-muted-border: #27302d;
  --button-muted-fg: #ece9df;
  --button-muted-hover: #313b37;
  --tag-bg: #222927;
  --tag-border: rgba(236, 233, 223, 0.12);
  --tag-fg: #d7d2c5;
  --inline-code-bg: #232927;
  --inline-code-border: rgba(236, 233, 223, 0.14);
  --inline-code-fg: #f7f3ea;
  --post-hover-bg: rgba(24, 30, 28, 0.98);
  --post-hover-shadow: 0 14px 32px rgba(0, 0, 0, 0.24);
  --network-line: rgba(236, 233, 223, 0.26);
  --network-node: rgba(236, 233, 223, 0.6);
  --network-glow: rgba(84, 112, 100, 0.44);
  --code-bg: #0c0f0f;
  --code-fg: #f4f1e8;
  --code-comment: #8f978b;
  --code-operator: #d9d3c7;
  --code-name: #9acfe9;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
    radial-gradient(circle at top, var(--glow), transparent 42rem),
    var(--bg);
  background-size: 24px 24px, 24px 24px, auto, auto;
  color: var(--text);
  font-family: var(--mono);
  line-height: 1.8;
  transition: background-color 180ms ease, color 180ms ease;
}

::selection {
  background: var(--selection-bg);
  color: var(--selection-fg);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

a:hover {
  text-decoration: underline;
}

.site-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: min(100% - 2rem, 68rem);
  margin: 0 auto;
  padding: 2.5rem 0 5rem;
}

main {
  flex: 1;
}

.main-home {
  display: flex;
  flex-direction: column;
}

.home-hero {
  min-height: clamp(28rem, calc(100vh - 15rem), 42rem);
  overflow: visible;
  position: relative;
}

.home-hero-network {
  height: 100%;
  left: 50%;
  min-width: 100%;
  opacity: 1;
  pointer-events: none;
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  width: min(112rem, calc(100vw + 14rem));
  z-index: 0;
}

.hero-home {
  margin: 0 auto;
  max-width: 68rem;
  position: relative;
  z-index: 2;
}

.site-header,
.site-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.site-header {
  border-bottom: 1px solid var(--line);
  padding: 0 0 1.4rem;
  margin-bottom: 3rem;
}

.site-header-controls {
  align-items: center;
  display: flex;
  gap: 1rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 4rem;
  padding-top: 1rem;
}

.site-title {
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.site-tagline {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.45rem 0 0;
}

.site-nav {
  display: flex;
  gap: 1rem;
}

.site-nav a {
  color: var(--muted);
  border-bottom: 1px solid transparent;
  padding-bottom: 0.15rem;
}

.site-nav a[aria-current="page"],
.site-nav a:hover {
  color: var(--text);
  border-color: var(--line-strong);
  text-decoration: none;
}

.hero,
.document-header,
.post,
.card,
.post-preview {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.hero,
.document-header,
.post {
  padding: 0;
}

.hero h1,
.document-header h1,
.post h1 {
  font-size: clamp(2.1rem, 5vw, 3.3rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 1.25rem;
  max-width: none;
}

.hero h1 {
  max-width: none;
}

.post h1 {
  max-width: none;
}

.lead {
  color: var(--muted);
  font-size: 1.02rem;
  max-width: 38rem;
}

.eyebrow,
.article-meta {
  color: var(--muted);
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  margin: 0 0 0.9rem;
  text-transform: none;
}

.hero-topline {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}

.hero-topline .eyebrow {
  margin: 0;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.hero-links {
  display: flex;
  gap: 0.1rem;
  justify-content: flex-end;
  margin-top: 0.35rem;
}

.icon-link {
  align-items: center;
  color: var(--text);
  display: inline-flex;
  height: 3.25rem;
  justify-content: center;
  text-decoration: none;
  width: 3.25rem;
}

.icon-link svg {
  height: 1.5rem;
  width: 1.5rem;
}

.icon-link:hover {
  color: var(--muted);
  text-decoration: none;
}

.icon-link-muted {
  color: var(--muted);
}

.theme-toggle {
  align-items: center;
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  font-family: var(--mono);
  font-size: 0.85rem;
  height: 2.45rem;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 2.45rem;
  transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  background: var(--accent-soft);
  border-color: var(--line-strong);
  color: var(--text);
  outline: none;
}

.theme-toggle-icon {
  height: 1.1rem;
  pointer-events: none;
  position: absolute;
  transition: opacity 140ms ease, transform 140ms ease;
  width: 1.1rem;
}

.theme-toggle-icon-sun {
  opacity: 1;
  transform: scale(1);
}

.theme-toggle-icon-moon {
  opacity: 0;
  transform: scale(0.82);
}

.theme-toggle[data-theme="dark"] .theme-toggle-icon-sun {
  opacity: 0;
  transform: scale(0.82);
}

.theme-toggle[data-theme="dark"] .theme-toggle-icon-moon {
  opacity: 1;
  transform: scale(1);
}

.button {
  background: var(--button-bg);
  border: 1px solid var(--button-border);
  border-radius: 0;
  box-shadow: none;
  color: var(--button-fg);
  display: inline-block;
  padding: 0.55rem 0.8rem;
  text-decoration: none;
}

.button:hover {
  background: var(--button-hover);
  border-color: var(--button-hover);
  text-decoration: none;
}

.button-muted {
  background: var(--button-muted-bg);
  border-color: var(--button-muted-border);
  color: var(--button-muted-fg);
}

.button-muted:hover {
  background: var(--button-muted-hover);
  border-color: var(--button-muted-hover);
}

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

.card,
.post-preview {
  padding: 1.15rem 1.2rem 1.05rem;
  background: var(--paper);
  border: 1px solid var(--line);
  position: relative;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.card h2,
.post-preview h2,
.cv-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}

.card::before,
.cv-section::before,
.document-header::before,
.post::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--text) 0 3.2rem, transparent 3.2rem);
}

.link-list,
.contact-list,
.publication-list,
.cv-section ul {
  margin: 0.75rem 0 0;
  padding-left: 1.2rem;
}

.contact-list {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  list-style: none;
  padding: 0;
}

.document {
  display: grid;
  gap: 2.5rem;
}

.blog-search {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 1.35rem;
  position: relative;
}

.blog-search::before {
  content: none;
}

.search-label {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 0.55rem;
}

.search-input {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--mono);
  font-size: 1rem;
  line-height: 1.4;
  padding: 0.8rem 0.9rem;
  width: 100%;
}

.search-input:focus {
  border-color: var(--line-strong);
  outline: none;
}

.search-status {
  color: var(--muted);
  margin: 0.75rem 0 0;
}

.search-results {
  display: grid;
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.search-results[hidden] {
  display: none;
}

.document-header,
.post {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 1.35rem 1.35rem 1.2rem;
  position: relative;
}

.cv-section {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 1.35rem 1.35rem 1.2rem;
  position: relative;
}

.cv-item + .cv-item {
  border-top: 1px solid var(--line);
  margin-top: 1.5rem;
  padding-top: 1.5rem;
}

.cv-heading {
  align-items: baseline;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.cv-heading h3,
.post-preview h2 {
  margin: 0;
}

.cv-heading-with-link {
  align-items: center;
  display: inline-flex;
  gap: 0.35rem;
}

.cv-inline-icon {
  align-items: center;
  border-bottom: 1px solid transparent;
  color: var(--muted);
  display: inline-flex;
  justify-content: center;
  opacity: 0.82;
  text-decoration: none;
  transform: translateY(0.02rem);
  transition: color 140ms ease, opacity 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.cv-inline-icon svg {
  height: 0.82rem;
  width: 0.82rem;
}

.cv-inline-icon:hover,
.cv-inline-icon:focus-visible {
  color: var(--text);
  opacity: 1;
  outline: none;
  transform: translateY(0.02rem) translateX(0.04rem);
}

.cv-heading p,
.role {
  color: var(--muted);
  margin: 0;
}

.scholarship-item + .scholarship-item {
  border-top: 1px solid var(--line);
  margin-top: 1rem;
  padding-top: 1rem;
}

.scholarship-row {
  align-items: start;
  column-gap: 1.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.scholarship-row h3 {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.6;
  margin: 0;
}

.scholarship-row p {
  color: var(--muted);
  margin: 0;
  text-align: right;
  white-space: nowrap;
}

.post {
  max-width: 100%;
}

.post-feed,
.search-results {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: 1fr;
}

.post-preview {
  display: grid;
  gap: 0.45rem;
  min-height: 100%;
  padding: 0.95rem 1rem 0.9rem;
}

.post-preview p:last-child,
.card p:last-child {
  margin-bottom: 0;
}

.post-preview-header {
  align-items: baseline;
  column-gap: 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.post-preview .article-meta {
  font-size: 0.8rem;
  margin: 0;
  white-space: nowrap;
}

.post-preview h2 {
  font-size: 0.98rem;
  line-height: 1.35;
  margin: 0;
}

.post-preview-excerpt {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
  margin: 0.1rem 0 0;
}

.post-preview-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.05rem 0 0;
}

.tag-chip {
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  border-radius: 999px;
  color: var(--tag-fg);
  display: inline-flex;
  font-size: 0.76rem;
  line-height: 1;
  padding: 0.3rem 0.55rem;
}

.post-preview-link-overlay {
  border-radius: 0;
  color: inherit;
  display: block;
  text-decoration: none;
}

.post-preview:hover h2,
.post-preview:focus-within h2,
.post-preview-link-overlay:focus-visible h2 {
  text-decoration: underline;
}

.post ul,
.cv-section ul {
  line-height: 1.8;
}

.text-link {
  font-weight: 600;
}

.hero {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: clamp(26rem, calc(100vh - 17rem), 40rem);
  padding-left: 0.2rem;
}

.hero .eyebrow::before,
.document-header .eyebrow::before,
.article-meta::before {
  content: "> ";
  color: var(--text);
}

.link-list li + li,
.publication-list li + li,
.cv-section li + li {
  margin-top: 0.45rem;
}

.card:hover,
.post-preview:hover,
.document-header:hover,
.post:hover,
.cv-section:hover {
  border-color: var(--line-strong);
}

.post-preview:hover,
.post-preview:focus-within {
  background: var(--post-hover-bg);
  box-shadow: var(--post-hover-shadow);
  transform: translateY(-2px);
}

.post h2,
.post h3,
.post h4 {
  margin-top: 2rem;
  margin-bottom: 0.8rem;
}

.post code,
.cv-section code,
.card code {
  background: var(--inline-code-bg);
  border-radius: 0.15rem;
  border: 1px solid var(--inline-code-border);
  color: var(--inline-code-fg);
  font-weight: 600;
  letter-spacing: 0.01em;
  font-size: 0.92em;
  padding: 0.08rem 0.3rem;
}

.post pre,
.post .highlight {
  background: var(--code-bg);
  border: 1px solid rgba(244, 241, 232, 0.08);
  border-radius: 0.2rem;
  color: var(--code-fg);
  margin: 1.25rem 0;
  overflow-x: auto;
  padding: 1rem 1.1rem;
  position: relative;
}

.post .highlight pre {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  overflow: visible;
  padding: 0;
  position: static;
}

.post pre code,
.post .highlight code {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: inherit;
  display: block;
  font-weight: 400;
  letter-spacing: 0;
  padding: 0;
}

.post .highlight pre {
  display: block;
}

.post pre,
.post .highlight,
.post .highlight .w {
  color: var(--code-fg);
  font-family: var(--mono);
}

.post :not(pre) > code,
.cv-section :not(pre) > code,
.card :not(pre) > code {
  color: var(--inline-code-fg);
}

.post .highlight .c,
.post .highlight .c1,
.post .highlight .cm,
.post .highlight .cp,
.post .highlight .cs {
  color: var(--code-comment);
}

.post .highlight .k,
.post .highlight .kc,
.post .highlight .kd,
.post .highlight .kn,
.post .highlight .kp,
.post .highlight .kr,
.post .highlight .kt {
  color: var(--code-keyword);
}

.post .highlight .s,
.post .highlight .s1,
.post .highlight .s2,
.post .highlight .sa,
.post .highlight .sb,
.post .highlight .sc,
.post .highlight .sd,
.post .highlight .se,
.post .highlight .sh,
.post .highlight .si,
.post .highlight .sr,
.post .highlight .ss,
.post .highlight .sx,
.post .highlight .dl {
  color: var(--code-string);
}

.post .highlight .m,
.post .highlight .mb,
.post .highlight .mf,
.post .highlight .mh,
.post .highlight .mi,
.post .highlight .mo,
.post .highlight .il {
  color: var(--code-number);
}

.post .highlight .n,
.post .highlight .na,
.post .highlight .nb,
.post .highlight .nc,
.post .highlight .nd,
.post .highlight .ne,
.post .highlight .nf,
.post .highlight .fm,
.post .highlight .nn,
.post .highlight .nt,
.post .highlight .nv,
.post .highlight .vc,
.post .highlight .vg,
.post .highlight .vi {
  color: var(--code-name);
}

.post .highlight .o,
.post .highlight .ow,
.post .highlight .p {
  color: var(--code-operator);
}

.post .code-block {
  position: relative;
}

.post .code-copy-button {
  appearance: none;
  background: rgba(243, 243, 239, 0.12);
  border: 1px solid rgba(244, 241, 232, 0.16);
  border-radius: 0.15rem;
  color: var(--code-fg);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  line-height: 1;
  padding: 0.45rem 0.55rem;
  position: absolute;
  right: 0.7rem;
  top: 0.7rem;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
  z-index: 2;
}

.post .code-copy-button:hover,
.post .code-copy-button:focus-visible {
  background: rgba(243, 243, 239, 0.2);
  border-color: rgba(244, 241, 232, 0.28);
  outline: none;
}

.post .code-copy-button.is-copied {
  background: rgba(154, 215, 176, 0.18);
  border-color: rgba(154, 215, 176, 0.4);
  color: #dff6e7;
}

.post blockquote {
  border-left: 2px solid var(--line-strong);
  color: var(--muted);
  margin-left: 0;
  padding-left: 1rem;
}

.post sup {
  font-size: 0.75em;
  line-height: 0;
}

.post sup a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.post sup a:hover,
.post sup a:focus-visible {
  text-decoration: underline;
}

.post .citation-separator {
  font-size: 0.75em;
  line-height: 0;
  margin: 0 0.04em;
}

.post .footnotes {
  border-top: 1px solid var(--line);
  margin-top: 2.5rem;
  padding-top: 1.25rem;
}

.post .footnotes p,
.post .footnotes li {
  color: var(--muted);
  font-size: 0.96rem;
}

.post .footnotes ol {
  margin-bottom: 0;
  padding-left: 1.25rem;
}

.post .footnotes li {
  margin-bottom: 0.75rem;
}

.post .reversefootnote {
  font-size: 0.9em;
  margin-left: 0.25rem;
  text-decoration: none;
}

@media (max-width: 700px) {
  .site-header,
  .site-footer,
  .cv-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .hero-topline {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
  }

  .site-header-controls {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-links {
    justify-content: flex-start;
  }

  .home-hero {
    min-height: clamp(24rem, calc(100vh - 14rem), 34rem);
  }

  .home-hero-network {
    width: calc(100vw + 4rem);
  }

  .site-shell {
    width: min(100% - 1.25rem, 68rem);
    padding-top: 1.25rem;
  }

  .hero h1,
  .document-header h1,
  .post h1 {
    max-width: none;
  }

  .hero,
  .document-header,
  .post,
  .card,
  .post-preview,
  .cv-section,
  .hero-home {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .scholarship-row {
    gap: 0.25rem;
    grid-template-columns: 1fr;
  }

  .scholarship-row p {
    text-align: left;
  }

  .post-preview-header {
    gap: 0.2rem;
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-hero-network {
    opacity: 0.55;
  }
}
