@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Source+Serif+4:wght@500;600;700&display=swap');

:root {
  --main-width: 64rem;
  --body-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono-font: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', 'Courier New', monospace;
}

html {
  font-size: 15px;
}

body {
  font-family: var(--body-font);
  line-height: 1.7;
  letter-spacing: -0.01em;
  font-feature-settings: 'liga' 1, 'calt' 1;
}

main.main {
  max-width: var(--main-width);
  margin: 0 auto;
  padding-left: clamp(1.2rem, 4vw, 3rem);
  padding-right: clamp(1.2rem, 4vw, 3rem);
}

.home-info {
  padding: clamp(1.8rem, 4vw, 2.6rem) clamp(2rem, 5vw, 3.2rem);
}

.home-info .entry-header {
  text-align: center;
}

.home-info .entry-header h1 {
  font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  font-size: clamp(2.2rem, 2.6vw + 1.4rem, 2.9rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.home-info .entry-content {
  max-width: min(52rem, 100%);
  margin: 0 auto;
  font-size: 1.08rem;
  line-height: 1.9;
  color: color-mix(in srgb, currentColor 76%, transparent);
}

.home-info .entry-content p,
.home-info .entry-content li {
  margin: 1rem 0;
}

.home-info .entry-content ul {
  list-style: disc;
  padding-left: 1.4rem;
}

.home-info .entry-content a {
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.07em;
}

.home-info .home-socials {
  display: flex;
  justify-content: center;
  gap: 1.4rem;
  margin-bottom: 1rem;
}

.home-info .home-socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.6rem;
  height: 3.6rem;
  color: var(--primary);
  transition: transform 0.18s ease;
}

.home-info .home-socials a:hover {
  transform: translateY(-3px);
}

.home-info .home-socials svg {
  width: 2rem;
  height: 2rem;
}

.home-info .home-socials .social-twitter {
  color: #0f1419;
}

.home-info .home-socials .social-github {
  color: #161b22;
}

.home-info .home-socials .social-linkedin {
  color: #0a66c2;
}

.single .post-title {
  font-weight: 700;
  letter-spacing: -0.015em;
}

.single .post-content {
  font-size: 1rem;
}

.single .post-content h2,
.single .post-content h3 {
  font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  letter-spacing: -0.01em;
}

.single .post-content h2 {
  margin-top: 2.4rem;
  margin-bottom: 0.8rem;
  font-size: clamp(1.45rem, 3vw, 1.72rem);
  line-height: 1.3;
}

.single .post-content h3 {
  margin-top: 1.8rem;
  margin-bottom: 0.6rem;
  font-size: clamp(1.18rem, 2.2vw, 1.32rem);
  line-height: 1.32;
}

.single .post-content p,
.single .post-content li {
  margin: 0.85rem 0;
}

.single .post-content li {
  padding-left: 0.12rem;
}

.single .post-content a {
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.08em;
}

.single .post-content pre,
.single .post-content code {
  font-family: var(--mono-font);
}

.single .post-content pre {
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  background: color-mix(in oklab, currentColor 10%, transparent);
  border: 1px solid color-mix(in oklab, currentColor 20%, transparent);
  box-shadow: 0 20px 60px -44px rgba(15, 23, 42, 0.55);
  margin: 1.6rem 0;
}

.single .post-content pre code {
  display: block;
  font-size: 0.98rem;
  line-height: 1.7;
}

.single .post-content .highlight {
  margin: 1.6rem 0;
  border-radius: 14px;
  overflow: hidden;
  background: color-mix(in oklab, currentColor 10%, transparent);
  border: 1px solid color-mix(in oklab, currentColor 20%, transparent);
  box-shadow: 0 20px 60px -44px rgba(15, 23, 42, 0.55);
}

.single .post-content .highlight pre {
  margin: 0;
  padding: 0 !important;
  background: transparent !important;
  color: inherit !important;
  border: none;
  border-radius: inherit;
  box-shadow: none;
}

.single .post-content .highlight pre code {
  padding: 1.25rem 1.5rem;
  display: block;
  background: transparent !important;
  border-radius: inherit;
  font-size: 0.98rem;
  line-height: 1.7;
}

.single .post-content :not(pre) > code {
  background: color-mix(in oklab, currentColor 12%, transparent);
  border: 1px solid color-mix(in oklab, currentColor 20%, transparent);
  padding: 0.05rem 0.35rem;
  border-radius: 6px;
}

.single .post-content figure {
  margin: 2rem auto;
  text-align: center;
}

.single .post-content figure img {
  margin: 0 auto;
}

.single .post-content figure figcaption {
  margin-top: 0.7rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: color-mix(in srgb, currentColor 65%, transparent);
}


.toc {
  background: none !important;
  border: none !important;
  margin: 0 0 2.4rem;
  padding: 0;
  color: inherit;
}

.toc details {
  border: none;
  padding: 0;
}

.toc details summary {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin: 0 0 0.9rem;
  cursor: pointer;
  color: color-mix(in srgb, currentColor 58%, transparent);
}

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

.toc details summary::before {
  content: '';
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.26;
}

.toc .details {
  font-weight: 600;
  letter-spacing: inherit;
}

.toc .inner {
  margin: 0;
  padding: 0 0 0 1.2rem;
  border-left: 2px solid color-mix(in srgb, currentColor 35%, transparent);
}

.toc nav {
  margin: 0;
  padding: 0;
}

.toc nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.38rem;
  font-size: 0.97rem;
}

.toc nav ul ul {
  margin-top: 0.32rem;
  padding-left: 1rem;
  gap: 0.28rem;
}

.toc nav a {
  text-decoration: none;
  color: inherit;
  transition: color 0.18s ease;
}

.toc nav a:hover {
  color: var(--primary);
}

.pub-list {
  margin-top: 1.4rem;
  display: grid;
  gap: 1rem;
}

.pub-item {
  display: grid;
  gap: 0.45rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid color-mix(in oklab, currentColor 14%, transparent);
}

.pub-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.pub-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 560;
  line-height: 1.42;
}

.pub-title a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.24em;
  text-decoration-thickness: 0.07em;
}

.pub-title a:hover {
  opacity: 0.85;
}

.pub-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: color-mix(in oklab, currentColor 58%, transparent);
}

.pub-summary {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: color-mix(in oklab, currentColor 70%, transparent);
}

.sidenote-ref {
  font-size: 0.78em;
  vertical-align: super;
  margin-left: 2px;
  opacity: 0.7;
}

.sidenote {
  float: right;
  clear: right;
  width: min(240px, 32vw);
  margin: 0.2rem 0 0.6rem 1.2rem;
  font-size: 0.9rem;
  line-height: 1.45;
  opacity: 0.9;
}

@media (max-width: 1024px) {
  .sidenote {
    float: none;
    width: auto;
    margin: 0.6rem 0;
    padding-left: 0.75rem;
    border-left: 2px solid color-mix(in oklab, currentColor 15%, transparent);
  }
}

.plot {
  margin: 1.5rem 0;
}

.plot img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 18px 40px -36px rgba(0, 0, 0, 0.65);
}

.plot figcaption {
  text-align: center;
  font-size: 0.92rem;
  opacity: 0.78;
  margin-top: 0.6rem;
}

.plot-wide {
  width: 100vw;
  margin-left: calc(50% - 50vw);
}

.plot-wide img {
  max-width: min(1200px, 92vw);
  margin: 0 auto;
  display: block;
}

@media (max-width: 720px) {
  main.main {
    padding-left: 1.1rem;
    padding-right: 1.1rem;
  }

  html {
    font-size: 16px;
  }

  .post-content {
    font-size: 1.02rem;
  }

  .home-info {
    padding: 1.9rem 1.4rem;
  }

  .home-info .home-socials {
    gap: 1rem;
  }

  .home-info .home-socials a {
    width: 3rem;
    height: 3rem;
  }

  .home-info .home-socials svg {
    width: 1.6rem;
    height: 1.6rem;
  }

  .single .post-content .highlight pre code {
    padding: 1.1rem;
  }

}

@media (min-width: 1100px) {
  .single .post-content .toc {
    float: left;
    width: min(18rem, 32vw);
    margin: 0.3rem 2.4rem 2.4rem 0;
  }

  .single .post-content .toc details {
    position: sticky;
    top: 6.4rem;
  }
}

@media (prefers-color-scheme: dark) {
  .single .post-content pre {
    background: color-mix(in oklab, currentColor 16%, transparent);
    border-color: color-mix(in oklab, currentColor 32%, transparent);
  }

  .single .post-content :not(pre) > code {
    background: color-mix(in oklab, currentColor 18%, transparent);
    border-color: color-mix(in oklab, currentColor 30%, transparent);
  }

  .toc .inner {
    border-left-color: color-mix(in srgb, currentColor 48%, transparent);
  }

  .home-info .home-socials .social-twitter,
  .home-info .home-socials .social-github {
    color: #f5f6f7;
  }

  .single .post-content .highlight {
    background: color-mix(in oklab, currentColor 16%, transparent);
    border-color: color-mix(in oklab, currentColor 32%, transparent);
  }
}

body.dark .post-content img[src$=".svg"],
body.dark .home-info img[src$=".svg"] {
  filter: invert(0.92) hue-rotate(180deg) saturate(1.15);
  transition: filter 0.3s ease;
}

body.dark .post-content img[src$=".svg"]:hover,
body.dark .home-info img[src$=".svg"]:hover {
  filter: invert(0.92) hue-rotate(180deg) saturate(1.25);
}

@media (max-width: 640px) {
  .single .post-content pre code {
    white-space: pre-wrap;
    word-break: break-word;
  }
}
