:root {
  --bg: #f5f7f4;
  --panel: #ffffff;
  --panel-soft: #f0f3ef;
  --text: #161918;
  --muted: #66706b;
  --accent: #1d6b4f;
  --accent-soft: #e3efe9;
  --line: #d8dfda;
  --max-width: 920px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: "Noto Sans SC", sans-serif;
}

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

p,
li {
  color: var(--muted);
  line-height: 1.8;
}

img {
  max-width: 100%;
  border-radius: var(--radius-sm);
}

code,
pre {
  font-family: "IBM Plex Mono", monospace;
}

:not(pre) > code {
  padding: 0.15rem 0.4rem;
  border-radius: 0.45rem;
  background: var(--panel-soft);
  color: var(--text);
}

pre {
  overflow-x: auto;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #f8faf8;
}

blockquote {
  margin: 1.5rem 0;
  padding: 0.2rem 0 0.2rem 1rem;
  border-left: 3px solid var(--accent);
}

.site-shell {
  width: min(calc(100% - 2rem), var(--max-width));
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
}

.page-post .site-shell {
  width: min(calc(100% - 2rem), 1120px);
}

.site-header,
.content-card,
.content-page,
.post-detail,
.site-footer {
  background: var(--panel);
  border: 1px solid var(--line);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 0.95rem 1.1rem;
  border-radius: var(--radius-md);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.brand-mark {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  background: var(--accent);
  flex: none;
}

.brand-copy strong,
.hero h1,
.section-heading h2,
.archive-item h2,
.page-header h1,
.post-header h1,
.tag-section h2,
.post-row h3,
.post-stack-item h3 {
  font-family: "Manrope", "Noto Sans SC", sans-serif;
}

.brand-copy strong {
  font-size: 1rem;
  font-weight: 700;
}

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

.site-nav a,
.text-link,
.post-row h3 a,
.archive-item h2 a,
.post-stack-item h3 a {
  color: var(--muted);
  transition: color 0.2s ease;
}

.site-nav a:hover,
.text-link:hover,
.post-row h3 a:hover,
.archive-item h2 a:hover,
.post-stack-item h3 a:hover {
  color: var(--accent);
}

.site-main {
  display: grid;
  gap: 1rem;
}

.hero {
  display: block;
  padding: 1.5rem 0 0.4rem;
}

.hero-main {
  display: grid;
  gap: 0.65rem;
  max-width: 40rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.9rem, 5vw, 2.8rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.hero-text {
  max-width: 36rem;
  margin: 0;
  font-size: 1rem;
}

.eyebrow,
.hero-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.hero-actions,
.chip-row,
.post-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero-actions {
  margin-top: 0.15rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.6rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}

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

.button-secondary {
  color: var(--text);
}

.hero-link {
  color: var(--accent);
  font-weight: 600;
}

.hero-link:hover {
  text-decoration: underline;
  text-underline-offset: 0.2rem;
}

.content-card,
.content-page,
.post-detail {
  padding: 1.35rem 1.4rem;
  border-radius: var(--radius-lg);
}

.post-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.post-toc {
  position: sticky;
  top: 1rem;
}

.post-toc-inner {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  max-height: calc(100vh - 2rem);
  overflow: hidden;
}

.post-toc-label {
  margin: 0 0 0.8rem;
  color: var(--text);
  font-weight: 700;
}

.post-toc-nav {
  display: grid;
  gap: 0.35rem;
  max-height: calc(100vh - 5.8rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 0.2rem;
}

.post-toc-group {
  display: grid;
  gap: 0.2rem;
}

.post-toc-children {
  display: none;
  gap: 0.2rem;
}

.post-toc-group.is-open .post-toc-children {
  display: grid;
}

.post-toc-empty {
  margin: 0;
  font-size: 0.92rem;
}

.post-toc-link {
  display: block;
  margin-left: 0;
  padding: 0.42rem 0.55rem;
  border-left: 3px solid transparent;
  border-radius: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.93rem;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.post-toc-link.level-h3 {
  margin-left: 0;
  padding-left: 1.25rem;
  font-size: 0.88rem;
}

.post-toc-link:hover {
  color: var(--accent);
  background: #f5f8f6;
}

.post-toc-link.is-current-parent {
  color: #184a37;
  background: #edf5f0;
  border-left-color: #8db29f;
  font-weight: 600;
}

.post-toc-link.is-active {
  color: #143f2f;
  background: #e3efe9;
  border-left-color: #1d6b4f;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(29, 107, 79, 0.08);
}

.post-toc-link.is-active:hover {
  color: #143f2f;
  transform: none;
}

.intro-card p:last-child,
.empty-state {
  margin-bottom: 0;
}

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

.section-heading h2,
.page-header h1,
.post-header h1,
.tag-section h2 {
  margin: 0.25rem 0 0;
  font-size: clamp(1.45rem, 3vw, 2rem);
}

.post-list,
.post-stack,
.archive-list,
.tag-section {
  display: grid;
  gap: 0.9rem;
}

.post-row,
.post-stack-item,
.archive-item {
  display: grid;
  gap: 0.9rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

.post-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.post-row {
  grid-template-columns: 120px minmax(0, 1fr);
}

.post-row-date,
.post-card-meta,
.post-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.post-row-body h3,
.archive-item h2,
.post-stack-item h3 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

.post-row-body p,
.archive-item p,
.post-stack-item p {
  margin: 0;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.38rem 0.7rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.archive-item {
  grid-template-columns: 120px minmax(0, 1fr);
}

.page-header,
.post-header {
  margin-bottom: 1.5rem;
}

.page-description {
  max-width: 40rem;
}

.post-summary p {
  margin: 0;
}

.post-summary a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15rem;
}

.post-summary {
  max-width: 48rem;
}

.post-team {
  max-width: 48rem;
  margin-top: 0.45rem;
  color: var(--muted);
}

.post-team p {
  margin: 0;
}

.post-team a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15rem;
}

.page-content h2,
.page-content h3,
.post-content h2,
.post-content h3 {
  margin-top: 2rem;
  color: var(--text);
  scroll-margin-top: 1rem;
}

.page-content hr,
.post-content hr {
  margin: 2.4rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.page-content a,
.post-content a,
.site-footer a {
  color: var(--accent);
}

.page-content ul,
.page-content ol,
.post-content ul,
.post-content ol {
  padding-left: 1.2rem;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.post-content table,
.page-content table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: collapse;
}

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

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-md);
}

.site-footer p {
  margin: 0;
}

.dot {
  margin: 0 0.35rem;
  color: var(--muted);
}

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

  .post-row,
  .archive-item {
    grid-template-columns: 1fr;
    gap: 0.45rem;
  }
}

@media (max-width: 960px) {
  .page-post .site-shell {
    width: min(calc(100% - 1rem), 1120px);
  }

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

  .post-toc {
    position: static;
  }
}

@media (max-width: 640px) {
  .site-shell {
    width: min(calc(100% - 1rem), var(--max-width));
    padding-top: 0.5rem;
  }

  .site-header,
  .content-card,
  .content-page,
  .post-detail,
  .site-footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}
