:root {
  color-scheme: light;
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-soft: #f3f4f6;
  --ink: #111827;
  --muted: #5b6472;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --rust: #6b7280;
  --blue: #2563eb;
  --shadow: none;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1115;
  --surface: #151922;
  --surface-soft: #1f2430;
  --ink: #f8fafc;
  --muted: #a8b0bd;
  --line: #293241;
  --accent: #60a5fa;
  --accent-strong: #93c5fd;
  --rust: #a8b0bd;
  --blue: #60a5fa;
  --shadow: none;
}

* {
  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",
    "Microsoft YaHei", sans-serif;
  line-height: 1.65;
}

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

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 64px;
  padding: 0 6vw;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 74%, transparent);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(18px);
}

.brand {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 800;
  letter-spacing: 0;
}

.nav {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 0.95rem;
}

.nav a {
  padding: 10px 0;
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--accent-strong);
}

.theme-toggle {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.eyebrow,
.section-label,
.project-lang {
  margin: 0 0 10px;
  color: var(--rust);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 18px;
  font-size: clamp(3.8rem, 9vw, 8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 12px;
  font-size: 1.25rem;
  line-height: 1.25;
  letter-spacing: 0;
}

.lead {
  max-width: 680px;
  color: var(--muted);
  font-size: clamp(1.15rem, 2vw, 1.45rem);
}

.lead a,
.focus-block a,
.plain-link {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.lead span {
  display: block;
  margin-top: 8px;
}

.blog-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 38px 6vw 78px;
}

.blog-intro {
  max-width: 780px;
  margin-bottom: 34px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.blog-intro h1 {
  margin-bottom: 12px;
  font-size: clamp(2.4rem, 6vw, 4.8rem);
  line-height: 1.05;
}

.blog-intro p {
  color: var(--muted);
  font-size: 1.08rem;
}

.blog-intro a,
.feed-item a,
.side-box a,
.archive-link {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.blog-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 44px;
  align-items: start;
}

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

.section-heading.tight {
  align-items: start;
  margin-bottom: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.section-heading.tight h2 {
  font-size: clamp(1.7rem, 3vw, 2.4rem);
}

.feed-item {
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.archive-list time,
.feed-item time,
.post-meta {
  color: var(--rust);
  font-size: 0.92rem;
  font-weight: 800;
}

.feed-item h3 {
  margin: 0 0 10px;
  font-size: clamp(1.35rem, 2.4vw, 1.95rem);
  line-height: 1.15;
}

.feed-item p {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.04rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tag-row span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.archive-link {
  display: inline-flex;
  margin-top: 28px;
}

.blog-sidebar {
  display: grid;
  gap: 18px;
  position: sticky;
  top: 84px;
}

.side-box {
  padding: 0 0 20px;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.side-box h2 {
  margin-bottom: 12px;
  font-size: 1.12rem;
  line-height: 1.2;
}

.side-box p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.96rem;
}

.side-avatar {
  width: 72px;
  height: 72px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.side-links,
.repo-mini-list,
.topic-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mini-tag-cloud,
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mini-tag-cloud a,
.tag-cloud a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 76%, var(--bg));
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.tag-cloud {
  margin-bottom: 34px;
}

.tag-cloud span {
  color: var(--muted);
  font-size: 0.78rem;
}

.tag-sections {
  display: grid;
  gap: 18px;
}

.tag-sections section {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.tag-sections h2 {
  margin-bottom: 14px;
  font-size: 1.45rem;
}

.tag-sections article {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.tag-sections time {
  color: var(--rust);
  font-weight: 800;
}

.tag-sections a {
  color: var(--accent-strong);
  font-weight: 800;
}

.side-links {
  margin-top: 14px;
}

.side-links a {
  width: fit-content;
}

.topic-list li,
.repo-mini-list li {
  display: grid;
  gap: 2px;
}

.topic-list span,
.repo-mini-list span {
  color: var(--muted);
  font-size: 0.88rem;
}

.portrait {
  margin: 0;
  justify-self: end;
  width: min(100%, 360px);
}

.portrait img {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  box-shadow: var(--shadow);
}

.portrait figcaption {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 16px;
  color: var(--muted);
}

.portrait strong {
  color: var(--ink);
}

.section-strip,
.content-band {
  padding: 72px 6vw;
  border-top: 1px solid var(--line);
}

.section-strip {
  display: grid;
  grid-template-columns: minmax(220px, 0.45fr) minmax(0, 1fr);
  gap: 36px;
  background: var(--surface-soft);
}

.now-grid,
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.now-grid article,
.post-card,
.project-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.now-grid article {
  padding: 22px;
}

.metric {
  display: block;
  margin-bottom: 10px;
  color: var(--blue);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.now-grid p,
.post-card p,
.project-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.focus-block {
  max-width: 920px;
  color: var(--muted);
  font-size: 1.08rem;
}

.focus-block.standalone {
  max-width: none;
  margin-bottom: 34px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.doc-links,
.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.doc-links a,
.card-links a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 85%, var(--bg));
  color: var(--accent-strong);
  font-size: 0.92rem;
  font-weight: 800;
}

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

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

.post-card a {
  display: grid;
  min-height: 260px;
  padding: 26px;
}

.post-card time {
  color: var(--rust);
  font-size: 0.92rem;
  font-weight: 700;
}

.post-card span {
  align-self: end;
  width: fit-content;
  margin-top: 28px;
  color: var(--accent-strong);
  font-weight: 800;
}

.project-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 230px;
  padding: 22px;
}

.project-card a {
  width: fit-content;
  color: var(--accent-strong);
  font-weight: 800;
}

.post-card:hover,
.project-card:hover {
  transform: translateY(-2px);
  transition: transform 160ms ease;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 30px 6vw 42px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.footer p {
  margin: 0;
}

.footer div {
  display: flex;
  gap: 14px;
}

.listing-page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 72px 6vw;
}

.page-heading {
  margin-bottom: 42px;
}

.page-heading h1 {
  font-size: clamp(3rem, 8vw, 6rem);
}

.archive-list,
.project-detail-list,
.contribution-list {
  display: grid;
  gap: 16px;
}

.archive-list article,
.project-detail,
.contribution-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.archive-list article,
.contribution-list article {
  padding: 24px;
}

.archive-list.compact {
  margin-top: 28px;
}

.archive-list time {
  color: var(--rust);
  font-weight: 800;
}

.archive-list h2 {
  margin-top: 8px;
  margin-bottom: 10px;
  font-size: 1.45rem;
}

.archive-list p,
.project-detail p,
.project-detail li,
.contribution-list p,
.topic-grid p {
  color: var(--muted);
}

.contribution-list h2 {
  margin-bottom: 10px;
  font-size: 1.45rem;
}

.project-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: start;
  padding: 24px;
}

.project-detail h2 {
  margin-bottom: 12px;
  font-size: 1.8rem;
}

.project-detail ul {
  margin-bottom: 0;
  padding-left: 1.2rem;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.topic-grid a {
  min-height: 180px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.topic-grid span {
  display: block;
  margin-bottom: 12px;
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 800;
}

.article-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 72px 6vw;
}

.article-page header {
  margin-bottom: 42px;
}

.article-page h1 {
  font-size: clamp(2.5rem, 6vw, 4.8rem);
  line-height: 1.02;
}

.article-meta {
  color: var(--rust);
  font-weight: 800;
}

.article-body {
  font-size: 1.08rem;
}

.article-body h2 {
  margin-top: 44px;
  margin-bottom: 14px;
  font-size: 1.8rem;
}

.article-body p,
.article-body li {
  color: color-mix(in srgb, var(--ink) 82%, var(--muted));
}

.article-body a {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 34px;
  color: var(--accent-strong);
  font-weight: 800;
}

@media (max-width: 900px) {
  .site-header {
    gap: 14px;
    padding-inline: 20px;
  }

  .nav {
    gap: 12px;
    font-size: 0.88rem;
  }

  .blog-layout,
  .section-strip,
  .post-list,
  .project-grid,
  .now-grid,
  .project-detail,
  .topic-grid {
    grid-template-columns: 1fr;
  }

  .blog-shell {
    padding: 34px 20px 60px;
  }

  .blog-sidebar {
    position: static;
  }

  .portrait {
    justify-self: start;
    width: min(100%, 300px);
  }

  .section-strip,
  .content-band {
    padding: 52px 20px;
  }

  .post-card a {
    min-height: 220px;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .brand {
    width: 36px;
    height: 36px;
    font-size: 0.86rem;
  }

  .nav {
    overflow-x: auto;
    white-space: nowrap;
  }

  .theme-toggle {
    flex: 0 0 auto;
  }

  h1 {
    font-size: clamp(3.2rem, 17vw, 4.7rem);
  }

  .footer {
    flex-direction: column;
  }

  .tag-sections article {
    grid-template-columns: 1fr;
  }
}

/* cxxmcp-inspired blog surface */
:root {
  --radius: 10px;
  --panel: var(--surface);
  --accent-bg: #effdfa;
}

[data-theme="dark"] {
  --accent-bg: #0f2927;
}

.blog-hero {
  padding: 52px 0 38px;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--line);
}

.blog-hero h1 {
  max-width: 800px;
  margin: 10px 0 14px;
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  line-height: 1.08;
}

.blog-hero .lede {
  max-width: 740px;
  color: var(--muted);
  font-size: 1.12rem;
}

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

.button,
.composer-actions button,
.composer-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--accent-strong);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button.primary,
.composer-actions button:first-child {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.feed-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  margin: 0 0 14px;
  padding: 20px;
}

.feed-item:hover,
.archive-list article:hover,
.project-detail:hover,
.contribution-list article:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
}

.side-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 18px;
}

.side-box + .side-box {
  margin-top: 0;
}

.article-page.with-toc {
  display: grid;
  grid-template-columns: minmax(0, 820px) 220px;
  gap: 38px;
  max-width: 1140px;
}

.article-main {
  min-width: 0;
}

.post-toc {
  position: sticky;
  top: 86px;
  align-self: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px;
}

.post-toc h2 {
  margin-bottom: 10px;
  font-size: 0.9rem;
  color: var(--muted);
  text-transform: uppercase;
}

.post-toc nav {
  display: grid;
  gap: 6px;
}

.post-toc a {
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
}

.post-toc a:hover {
  color: var(--accent-strong);
}

.post-toc a.h3 {
  padding-left: 12px;
  font-size: 0.84rem;
}

.article-body h2,
.article-body h3 {
  scroll-margin-top: 90px;
}

.publish-shell {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.publish-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 360px);
  gap: 24px;
  align-items: end;
  padding: 42px 0 30px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}

.publish-hero h1 {
  margin: 8px 0 12px;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.08;
}

.publish-hero p {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.08rem;
}

.publish-status {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px;
}

.publish-status span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.publish-status code {
  color: var(--accent-strong);
  overflow-wrap: anywhere;
}

.publish-grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.publish-guide {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 84px;
}

.publish-guide section,
.composer-window {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.publish-guide section {
  padding: 18px;
}

.publish-guide h2 {
  margin-bottom: 10px;
  font-size: 1rem;
}

.publish-guide ol {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.94rem;
}

.publish-guide a {
  display: block;
  padding: 7px 0;
  color: var(--accent-strong);
  font-weight: 750;
  text-decoration: none;
}

.composer-window {
  overflow: hidden;
}

.window-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.window-bar h2 {
  margin: 0;
  font-size: 1.05rem;
}

.window-bar p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.window-bar span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.post-composer {
  display: grid;
  gap: 16px;
  padding: 20px;
}

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

.post-composer label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.meta-field,
.editor-field {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.meta-field {
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  gap: 0;
  min-height: 46px;
  overflow: hidden;
}

.meta-field span,
.editor-field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.meta-field span {
  display: grid;
  height: 100%;
  place-items: center start;
  padding-left: 12px;
  border-right: 1px solid var(--line);
  background: var(--surface-soft);
}

.editor-field {
  overflow: hidden;
  gap: 0;
}

.editor-field span {
  display: block;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.post-composer input,
.post-composer textarea {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  padding: 11px 12px;
  font: inherit;
}

.post-composer input:focus,
.post-composer textarea:focus {
  outline: 0;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 24%, transparent);
}

.post-composer textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
  line-height: 1.55;
}

.editor-field:not(.small) textarea {
  min-height: 340px;
  resize: vertical;
}

.composer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.output-console {
  margin: 0 20px 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0f172a;
}

.console-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: #111827;
}

.console-bar span {
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.console-bar code {
  color: #67e8f9;
  font-size: 0.78rem;
}

.output-console pre {
  min-height: 340px;
  max-height: 560px;
  margin: 0;
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: #0f172a;
  padding: 16px;
}

.output-console code {
  color: #e5e7eb;
  white-space: pre;
  font-size: 0.9rem;
  line-height: 1.55;
}

@media (max-width: 900px) {
  .article-page.with-toc {
    grid-template-columns: 1fr;
  }

  .post-toc {
    position: static;
    order: -1;
  }

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

  .publish-shell {
    width: min(100% - 32px, 1120px);
    padding-top: 30px;
  }

  .publish-hero,
  .publish-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .publish-guide {
    position: static;
  }
}
