:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --sidebar: #242a31;
  --sidebar-soft: #323944;
  --ink: #26313d;
  --muted: #7b8794;
  --line: #e7ebf0;
  --soft: #f9fbfd;
  --accent: #2f6fed;
  --accent-dark: #1f4fb8;
  --code: #1f2933;
  --shadow: 0 14px 32px rgba(31, 41, 51, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 44px 28px 28px;
  background: var(--sidebar);
  color: #d7dde5;
  text-align: center;
}

.avatar-link {
  display: inline-flex;
  margin-bottom: 18px;
}

.avatar-link img {
  width: 112px;
  height: 112px;
  border: 4px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  object-fit: cover;
}

.site-title {
  color: #fff;
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.15;
}

.site-tagline {
  margin: 12px 0 28px;
  color: #abb5c2;
  font-size: 0.92rem;
}

.site-nav {
  width: 100%;
  display: grid;
  gap: 4px;
  margin: 10px 0 24px;
  text-align: left;
}

.site-nav a {
  display: block;
  padding: 11px 16px;
  border-radius: 8px;
  color: #cbd3dd;
  font-size: 0.86rem;
  font-weight: 760;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  background: var(--sidebar-soft);
  color: #fff;
}

.sidebar-links {
  display: flex;
  gap: 12px;
  margin-top: auto;
  color: #b9c2cf;
  font-size: 0.9rem;
}

.sidebar-links a:hover,
.sidebar-links a:focus-visible {
  color: #fff;
}

.content-shell {
  min-height: 100vh;
  margin-left: 260px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 0 clamp(22px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(246, 248, 251, 0.88);
  backdrop-filter: blur(18px);
  color: var(--muted);
  font-size: 0.94rem;
}

.topbar a {
  color: var(--accent-dark);
  font-weight: 760;
}

.topbar span::before {
  content: "/";
  margin-right: 10px;
  color: #a8b3c1;
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 760px) 260px;
  gap: clamp(28px, 5vw, 54px);
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(32px, 5vw, 58px) clamp(22px, 4vw, 48px) 64px;
}

.primary-column {
  min-width: 0;
}

.home-intro {
  padding: 18px 0 26px;
}

.home-intro h1 {
  margin: 0 0 12px;
  color: #1f2933;
  font-size: clamp(2.5rem, 8vw, 4.4rem);
  line-height: 1;
  letter-spacing: 0;
}

.career-objective {
  max-width: 720px;
  margin: 0 0 14px;
  color: var(--accent-dark);
  font-size: clamp(1.25rem, 3vw, 1.8rem);
  font-weight: 800;
  line-height: 1.18;
}

.hero-lede {
  max-width: 700px;
  margin: 0;
  color: #52606d;
  font-size: 1.08rem;
}

.hero-actions,
.intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.button,
.repo-link,
.profile-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--accent-dark);
  font-size: 0.92rem;
  font-weight: 760;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.button:hover,
.button:focus-visible,
.repo-link:hover,
.repo-link:focus-visible,
.profile-link:hover,
.profile-link:focus-visible {
  border-color: rgba(47, 111, 237, 0.38);
  box-shadow: 0 8px 22px rgba(47, 111, 237, 0.12);
}

.summary-card,
.content-card,
.post-preview,
.profile-panel,
.right-panel section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.summary-card {
  margin: 26px 0 34px;
  padding: clamp(22px, 4vw, 30px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 820;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h2 {
  margin: 0 0 14px;
  color: #1f2933;
  font-size: clamp(1.45rem, 4vw, 2rem);
  line-height: 1.18;
}

h3 {
  margin: 0 0 10px;
  color: #1f2933;
  font-size: 1.18rem;
  line-height: 1.28;
}

.summary-card p {
  margin-bottom: 0;
  color: #52606d;
}

.lead-copy {
  max-width: 760px;
  margin-bottom: 18px;
  color: #52606d;
  font-size: 1.04rem;
}

.about-list {
  display: grid;
  gap: 10px;
  max-width: 820px;
  margin: 0;
  padding-left: 1.1rem;
  color: #52606d;
}

.posts-section h2 {
  margin-bottom: 16px;
}

.post-list {
  display: grid;
  gap: 18px;
}

.post-preview {
  padding: 24px;
}

.post-preview h3 a {
  color: #1f2933;
}

.post-preview h3 a:hover,
.post-preview h3 a:focus-visible {
  color: var(--accent-dark);
}

.post-preview p {
  margin-bottom: 14px;
  color: #607080;
}

.post-preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.post-preview-meta span::before {
  content: "#";
  color: #a8b3c1;
}

.right-panel {
  position: sticky;
  top: 82px;
  align-self: start;
  display: grid;
  gap: 18px;
}

.right-panel section {
  padding: 20px;
}

.right-panel h2 {
  margin-bottom: 14px;
  color: #52606d;
  font-size: 1rem;
}

.compact-links {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: #52606d;
  font-size: 0.92rem;
  line-height: 1.45;
}

.compact-links a:hover,
.compact-links a:focus-visible {
  color: var(--accent-dark);
}

.compact-links span {
  display: block;
  margin-top: 3px;
  color: #9aa6b2;
  font-size: 0.78rem;
}

.tag-cloud,
.skill-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-cloud span,
.skill-cloud span,
.experience-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid #d8dee7;
  border-radius: 999px;
  background: var(--soft);
  color: #52606d;
  font-size: 0.82rem;
  font-weight: 720;
}

.content-page {
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(32px, 5vw, 58px) clamp(22px, 4vw, 48px) 64px;
}

.page-hero {
  margin-bottom: 22px;
  padding: clamp(24px, 5vw, 38px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.page-hero h1 {
  max-width: 760px;
  margin: 0 0 14px;
  color: #1f2933;
  font-size: clamp(2.2rem, 7vw, 4rem);
  line-height: 1.05;
}

.page-hero p:last-child {
  max-width: 760px;
  margin-bottom: 0;
  color: #52606d;
  font-size: 1.04rem;
}

.about-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: clamp(24px, 5vw, 42px);
  align-items: center;
}

.profile-panel {
  display: grid;
  gap: 16px;
  padding: 20px;
  box-shadow: none;
}

.profile-panel img {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  object-fit: cover;
}

.profile-name {
  margin-bottom: 6px;
  color: #1f2933;
  font-weight: 820;
}

.profile-role {
  margin-bottom: 12px;
  color: #607080;
  font-size: 0.93rem;
}

.profile-link {
  min-height: 34px;
  margin: 0 8px 8px 0;
}

.content-card {
  margin-top: 22px;
  padding: clamp(22px, 4vw, 34px);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 22px;
}

.intro-grid,
.contact {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(260px, 1fr);
  gap: clamp(24px, 5vw, 46px);
  align-items: start;
}

.intro-grid > p,
.contact p:last-child {
  margin: 0;
  color: #52606d;
  font-size: 1.02rem;
}

.metric-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.metric-list div {
  min-height: 130px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

dt {
  margin-bottom: 8px;
  color: var(--accent-dark);
  font-size: 1.65rem;
  font-weight: 850;
  line-height: 1;
}

dd {
  margin: 0;
  color: #607080;
  font-size: 0.92rem;
}

.timeline {
  display: grid;
  gap: 16px;
}

.simple-timeline {
  display: grid;
  gap: 12px;
}

.simple-timeline .experience-card {
  padding: 18px;
}

.experience-card,
.compact-list article,
.focus-grid article {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.experience-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 1.1rem;
  color: #52606d;
}

li::marker {
  color: var(--accent);
}

.compact-list {
  display: grid;
  gap: 12px;
}

.about-columns {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(260px, 1fr);
  gap: clamp(22px, 5vw, 42px);
  align-items: start;
}

.about-columns h3 {
  margin-bottom: 12px;
}

.compact-list h3,
.compact-list h4 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.compact-list p,
.focus-grid p {
  margin-bottom: 0;
  color: #607080;
}

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

.publications {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.publications.no-top-rule {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.publications ol {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 1.25rem;
  color: #52606d;
}

.post-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(32px, 5vw, 58px) clamp(22px, 4vw, 48px) 64px;
}

.post-shell {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.post-hero {
  padding: clamp(24px, 5vw, 38px);
  border-bottom: 1px solid var(--line);
}

.post-hero h1 {
  max-width: 100%;
  margin: 0 0 16px;
  color: #1f2933;
  font-size: clamp(2rem, 6vw, 3.4rem);
  line-height: 1.1;
}

.post-excerpt {
  max-width: 760px;
  margin-bottom: 0;
  color: #607080;
}

.back-link {
  display: inline-flex;
  margin-bottom: 18px;
  color: var(--accent-dark);
  font-size: 0.92rem;
  font-weight: 760;
}

.post-content {
  padding: clamp(24px, 5vw, 38px);
  color: #344150;
  font-size: 1.02rem;
  overflow-wrap: anywhere;
}

.post-content .key-insight {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 10px 16px;
  margin: 0.85rem 0 1.25rem;
  padding: 14px 16px;
  border-left: 4px solid #0f766e;
  border-radius: 0 6px 6px 0;
  background: #eef8f6;
  color: #263b3b;
  line-height: 1.6;
}

.key-insight strong {
  color: #0b625c;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 2.1;
  text-transform: uppercase;
}

.key-insight span {
  min-width: 0;
}

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

.post-content img {
  display: block;
  max-width: min(100%, 800px);
  height: auto;
  margin-inline: auto;
}

.post-figure img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.post-figure--scroll {
  overflow-x: auto;
  padding-bottom: 4px;
}

.post-figure--scroll img {
  min-width: 760px;
}

.mxfp4-step-diagrams {
  display: grid;
  gap: 0.9rem;
}

.mxfp4-step-diagram-grid {
  display: grid;
  gap: 1rem;
}

.mxfp4-inline-diagram {
  display: grid;
  gap: 0.65rem;
}

.mxfp4-step-card {
  display: grid;
  gap: 0.55rem;
  overflow-x: auto;
  padding-bottom: 2px;
}

.mxfp4-step-card img {
  width: 100%;
  min-width: 760px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.mxfp4-step-card p {
  margin: 0;
  color: #52606d;
  font-size: 0.94rem;
  line-height: 1.6;
}

.mxfp4-step-card strong {
  color: var(--accent-dark);
}
.post-figure figcaption {
  max-width: 800px;
  margin-inline: auto;
  margin-top: 0.7rem;
  color: #607080;
  font-size: 0.9rem;
  line-height: 1.6;
}

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

.post-compare-grid .post-figure {
  min-width: 0;
  margin: 0;
}

.post-chart {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.chart-grid {
  display: grid;
  gap: 24px;
}

.chart-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-panel {
  min-width: 0;
}

.chart-panel + .chart-panel {
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.chart-grid--two .chart-panel + .chart-panel {
  padding-top: 0;
  padding-left: 22px;
  border-top: 0;
  border-left: 1px solid var(--line);
}

.chart-grid--two .chart-panel:nth-child(n + 3) {
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.chart-grid--two .chart-panel:nth-child(odd) {
  padding-left: 0;
  border-left: 0;
}

.chart-grid--two .chart-panel--wide {
  grid-column: 1 / -1;
  padding-left: 0;
  border-left: 0;
}

.post-content .chart-title,
.post-content .chart-subtitle {
  margin: 0;
}

.chart-title {
  color: #273444;
  font-size: 1rem;
  font-weight: 780;
}

.chart-subtitle {
  color: #607080;
  font-size: 0.82rem;
}

.chart-frame {
  position: relative;
  width: 100%;
  height: 280px;
  margin-top: 12px;
}

.chart-frame--compact {
  height: 230px;
}

.chart-frame--tall {
  height: 360px;
}

.chart-frame--mobile-soc {
  height: 440px;
}

.chart-frame canvas {
  width: 100% !important;
  height: 100% !important;
}

.post-details {
  margin: 1.3rem 0 1.7rem;
  padding: 0.9rem 1rem 0.15rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.post-details summary {
  margin-bottom: 0.75rem;
  color: #273444;
  font-weight: 760;
  cursor: pointer;
}

.post-details[open] summary {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.post-content h2,
.post-content h3,
.post-content h4 {
  margin-top: 2.1em;
  margin-bottom: 0.7em;
}

.post-content h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.post-content p,
.post-content ul,
.post-content ol,
.post-content blockquote,
.post-content pre,
.post-content table {
  margin-bottom: 1.1rem;
}

.post-content table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.94rem;
}

.post-content th,
.post-content td {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.post-content th {
  background: #f4f7fb;
  color: #1f2933;
  font-weight: 760;
}

.tock-badge {
  display: inline-block;
  padding: 0.16rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 750;
  line-height: 1.35;
  white-space: nowrap;
}

.tock-badge--cpu {
  border-color: #f3c79d;
  background: #fff2e5;
  color: #9a4b08;
}

.tock-badge--gpu {
  border-color: #b9cff8;
  background: #edf4ff;
  color: #2457a7;
}

.gpu-family-label {
  white-space: nowrap;
}

.math-block {
  margin: 1.3rem 0;
  overflow-x: auto;
}

.post-content a {
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.post-content blockquote {
  margin-left: 0;
  padding-left: 16px;
  border-left: 4px solid var(--line);
  color: #607080;
}

.post-content pre {
  overflow-x: auto;
  padding: 18px;
  border-radius: 8px;
  background: var(--code);
  color: #f5f7fa;
}

.post-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.post-content :not(pre) > code {
  padding: 0.1em 0.32em;
  border-radius: 5px;
  background: #eef4ff;
  color: var(--accent-dark);
}

/* Rouge token colors for fenced code blocks. */
.post-content .highlight :is(.c, .ch, .cm, .c1, .cs, .cp, .cpf) {
  color: #a8b2c0;
}

.post-content .highlight :is(.k, .kc, .kd, .kn, .kp, .kr, .kt) {
  color: #c9afff;
}

.post-content .highlight :is(.s, .sa, .sb, .sc, .dl, .sd, .s2, .se, .sh, .si, .sx, .sr, .s1, .ss) {
  color: #b7df9b;
}

.post-content .highlight :is(.m, .mb, .mf, .mh, .mi, .il, .mo, .mx) {
  color: #f8bd96;
}

.post-content .highlight :is(.na, .nb, .bp, .nc, .nf, .fm, .nn, .nt) {
  color: #8fcfff;
}

.post-content .highlight :is(.o, .ow, .nd, .ne) {
  color: #ff9fad;
}

.post-content .highlight :is(.nv, .vc, .vg, .vi, .vm, .no) {
  color: #8edcdb;
}

.post-content .highlight :is(.err, .gd) {
  color: #ffd3d3;
  background: #552b35;
}

.post-content .highlight .gi {
  color: #c5f2bc;
  background: #243e32;
}

.post-content .highlight .ge {
  font-style: italic;
}

.post-content .highlight .gs {
  font-weight: 700;
}

.comments {
  margin: 0;
  padding: clamp(24px, 5vw, 38px);
  border-top: 1px solid var(--line);
}

.comments-heading {
  margin-bottom: 20px;
}

.comments-heading h2 {
  font-size: 1.6rem;
}

.site-footer {
  display: grid;
  gap: 6px;
  padding: 28px clamp(22px, 4vw, 48px) 34px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--accent-dark);
}

.visitor-counter {
  display: inline-flex;
  justify-content: center;
  line-height: 1;
}

.visitor-counter img {
  display: block;
  height: 20px;
}

@media (max-width: 1180px) {
  .page-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .right-panel {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .sidebar {
    position: static;
    width: auto;
    padding: 26px 22px;
  }

  .site-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    text-align: center;
  }

  .sidebar-links {
    margin-top: 0;
  }

  .content-shell {
    margin-left: 0;
  }

  .topbar {
    display: none;
  }

  .about-hero,
  .intro-grid,
  .contact,
  .about-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .sidebar {
    align-items: flex-start;
    text-align: left;
  }

  .site-nav,
  .right-panel,
  .metric-list,
  .focus-grid {
    grid-template-columns: 1fr;
  }

  .page-grid,
  .content-page,
  .post-page {
    padding-inline: 16px;
  }

  .section-heading {
    display: block;
  }

  .post-chart {
    padding: 16px 12px;
  }

  .post-content .key-insight {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 13px 14px;
  }

  .key-insight strong {
    line-height: 1.4;
  }

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

  .post-compare-grid {
    grid-template-columns: 1fr;
  }

  .chart-grid--two .chart-panel + .chart-panel {
    padding-top: 22px;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .chart-frame,
  .chart-frame--compact {
    height: 250px;
  }

  .chart-frame--tall {
    height: 300px;
  }

  .chart-frame--mobile-soc {
    height: 380px;
  }
}
