:root {
  color-scheme: light dark;
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #17202a;
  --muted: #64707d;
  --line: #d9ded8;
  --accent: #246b60;
  --accent-strong: #d8572a;
  --code-bg: #18202a;
  --code-text: #edf3f8;
  --max: 1120px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.72;
  overflow-wrap: break-word;
}
a { color: var(--accent); text-decoration-thickness: .08em; text-underline-offset: .18em; overflow-wrap: anywhere; }
img { display: block; max-width: 100%; height: auto; border-radius: 6px; }
.site-header, .site-main, .site-footer { width: min(100% - 32px, var(--max)); margin-inline: auto; }
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 0;
}
.brand { color: var(--text); font-weight: 800; text-decoration: none; }
.site-header nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 14px 18px; }
.site-header nav a { color: var(--muted); text-decoration: none; font-size: .95rem; }
.site-header nav a:hover { color: var(--text); }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, .95fr);
  align-items: center;
  gap: 48px;
  min-height: 320px;
  padding: 54px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.hero-title { min-width: 0; }
.hero-profile {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  padding: 28px;
  border-left: 1px solid var(--line);
}
.hero-avatar-large {
  width: 128px !important;
  max-width: 128px !important;
  height: 128px !important;
  max-height: 128px !important;
  aspect-ratio: 1 / 1;
  border-radius: 34px;
  border: 1px solid var(--line);
  object-fit: cover;
}
.hero-profile h2 {
  margin: 0 0 8px;
  line-height: 1.12;
  font-size: clamp(1.45rem, 3vw, 2.1rem);
}
.hero h1, .page-header h1, .article-header h1 {
  margin: 0;
  line-height: 1.08;
  font-size: clamp(2.1rem, 5vw, 4.25rem);
  max-width: 900px;
}
.hero p, .page-header p, .article-header p { max-width: 720px; color: var(--muted); font-size: 1.08rem; }
.eyebrow { margin: 0 0 10px; color: var(--accent-strong); font-size: .78rem; font-weight: 800; letter-spacing: 0; text-transform: uppercase; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 48px; padding: 48px 0; }
.post-list { display: grid; gap: 18px; }
.post-card {
  min-width: 0;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}
.post-card time, .archive-list time { color: var(--muted); font-size: .92rem; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: .92rem; }
.pin-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-strong) 14%, transparent);
  color: var(--accent-strong);
  font-size: .82rem;
  font-weight: 800;
}
.post-card h2 { min-width: 0; max-width: 100%; margin: 6px 0 8px; line-height: 1.22; font-size: clamp(1.35rem, 3vw, 2rem); overflow-wrap: anywhere; }
.post-card h2 a { color: var(--text); text-decoration: none; }
.post-card h2 a:hover { color: var(--accent); }
.post-card p { min-width: 0; max-width: 100%; margin: 0 0 14px; color: var(--muted); overflow-wrap: anywhere; word-break: break-word; }
.sidebar { display: grid; align-content: start; gap: 28px; padding-top: 24px; }
.sidebar h2, .toc h2, .comments h2 { margin: 0 0 12px; font-size: .95rem; text-transform: uppercase; color: var(--muted); }
.tag-cloud, .article-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud.large { padding-bottom: 48px; }
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  font-size: .9rem;
  text-decoration: none;
}
.page-header { padding: 56px 0 32px; border-top: 1px solid var(--line); }
.page-title-with-avatar {
  display: flex;
  align-items: center;
  gap: 22px;
}
.page-avatar {
  width: 76px !important;
  max-width: 76px !important;
  height: 76px !important;
  max-height: 76px !important;
  aspect-ratio: 1 / 1;
  flex: 0 0 auto;
  border-radius: 22px;
  border: 1px solid var(--line);
  object-fit: cover;
}
.archive-list { list-style: none; padding: 0 0 48px; margin: 0; display: grid; gap: 14px; }
.archive-list li { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 18px; align-items: baseline; }
.article { padding-bottom: 56px; }
.article-header { padding: 56px 0 36px; border-top: 1px solid var(--line); }
.article-layout { display: grid; gap: 48px; align-items: start; }
.article-layout.has-toc { grid-template-columns: 220px minmax(0, 760px); }
.article-layout.no-toc { grid-template-columns: minmax(0, 760px); justify-content: center; }
.toc { position: sticky; top: 24px; padding-top: 10px; }
.toc ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.toc li.level-3 { padding-left: 14px; }
.toc a { color: var(--muted); text-decoration: none; font-size: .92rem; }
.toc a:hover { color: var(--accent); }
.article-body { min-width: 0; max-width: 100%; font-size: 1.04rem; overflow-wrap: anywhere; word-break: break-word; }
.article-body h1, .article-body h2, .article-body h3, .article-body h4 {
  line-height: 1.22;
  margin: 2.2em 0 .7em;
}
.article-body h2 { font-size: 1.65rem; }
.article-body h3 { font-size: 1.28rem; }
.heading-anchor { float: left; margin-left: -1.1em; opacity: 0; text-decoration: none; }
.article-body h1:hover .heading-anchor,
.article-body h2:hover .heading-anchor,
.article-body h3:hover .heading-anchor,
.article-body h4:hover .heading-anchor { opacity: 1; }
.article-body p, .article-body ul, .article-body ol, .article-body blockquote, .article-body .table-wrap, .article-body pre { margin: 0 0 1.2em; }
.article-body blockquote { padding: 2px 0 2px 18px; border-left: 3px solid var(--accent); color: var(--muted); }
.article-body code {
  padding: .12em .36em;
  border-radius: 4px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  font-size: .9em;
}
.article-body pre {
  overflow-x: auto;
  padding: 18px;
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--code-text);
  line-height: 1.58;
}
.article-body pre code { padding: 0; background: transparent; color: inherit; }
.token.comment { color: #9aa8b5; }
.token.string { color: #9fd88d; }
.token.keyword { color: #82c7ff; }
.token.number { color: #ffbd7a; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 480px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); }
.post-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  max-width: 760px;
  margin: 44px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.post-nav a { display: grid; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; }
.post-nav a:last-child { text-align: right; }
.post-nav span { color: var(--muted); font-size: .86rem; }
.comments {
  max-width: 760px;
  margin: 36px auto 0;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.button { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border-radius: 6px; background: var(--accent); color: white; text-decoration: none; }
.site-footer { padding: 36px 0 48px; border-top: 1px solid var(--line); color: var(--muted); font-size: .92rem; }

@media (max-width: 820px) {
  .site-header { align-items: flex-start; flex-direction: column; }
  .site-header nav { justify-content: flex-start; }
  .hero { grid-template-columns: 1fr; gap: 28px; min-height: 0; padding: 42px 0 38px; }
  .hero-profile { grid-template-columns: 72px minmax(0, 1fr); gap: 16px; padding: 20px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .hero-avatar-large { width: 72px !important; max-width: 72px !important; height: 72px !important; max-height: 72px !important; border-radius: 20px; }
  .page-title-with-avatar { align-items: flex-start; }
  .page-avatar { width: 60px !important; max-width: 60px !important; height: 60px !important; max-height: 60px !important; border-radius: 18px; }
  .content-grid, .article-layout { grid-template-columns: 1fr; gap: 28px; }
  .toc { position: static; padding: 16px; border: 1px solid var(--line); border-radius: 8px; }
  .archive-list li { grid-template-columns: 1fr; gap: 2px; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav a:last-child { text-align: left; }
  .heading-anchor { display: none; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111417;
    --surface: #171c20;
    --text: #edf1f4;
    --muted: #a8b2bd;
    --line: #2a333a;
    --accent: #79c7b8;
    --accent-strong: #ff956f;
    --code-bg: #070a0d;
    --code-text: #edf3f8;
  }
}